Welcome visitor
* Login
* Register
It is currently September 15th, 2019, 9:53 pm
All times are UTC [ DST ]
* Search
View unanswered posts - View active topics

FORUMS » Client Side » JavaScript



Post new topic Reply to topic  [ 2 posts ] 
Author Message
  element id
PostPosted: March 19th, 2009, 12:24 am 
User avatar

Posts: 44
I would like to show on an input box the id of an object (any object) that is clicked by the user. This is for one object, but i want to do it for all (any) objects of the page:
<form name="form" action="">
<input type="text" name="text">
<input type="submit" value="Check!">
</form>
<img id="image" src="patas.jpg" onClick="document.form.text.value= 'image';">
Thanks.


Top
 Profile  
 
  Re: element id
PostPosted: March 19th, 2009, 12:30 am 
User avatar

Posts: 52
<body onClick="texf();">
function texf(){document.form.text.value=event.srcElement.id;}

for fun
<style>
body, html{cursor: crosshair;}
</style>


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

FORUMS » Client Side » JavaScript


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron