Reply
idiots & getElementById
Old 09-09-2006, 09:18 AM idiots & getElementById
purk's Avatar
Extreme Talker

Posts: 164
Name: James
Location: marbella & surrey
i have mapped image on my page which changes the text in a div element below the image, a caption changer if you will.

for some reason the caption doesn't change at all. is it not possible to edit a div elements value at runtime?

i have a workaround that i'd rather not use. i could just make the div an input.

javascript console shows no errors.

code as follows:

Code:
<area shape='rect' coords='{$row_img['coords']}' href='#' onclick='javascript:document.getElementById(\"img_caption\").value=\"" . $row_img['name'] . "\";'>

BTW: the slahes are used because the whole line is printed in a php echo.

the div element code is as follows:

Code:
<div id="img_caption" class="p"></div>
it's pro'lly something simple like wrong quotes or something but normally my sloppy code is easily debugged in the jsconsole but it reports all is well.

any input would be great.

thanks

p;
__________________
thatVilla.com - private villas direct from the owners - travel links always needed.

Last edited by purk : 09-09-2006 at 09:24 AM.
purk is offline
Reply With Quote
View Public Profile Visit purk's homepage!
 
When You Register, These Ads Go Away!
Old 09-09-2006, 10:55 PM Re: idiots & getElementById
funkdaddu's Avatar
Web Design Snob

Posts: 636
1) you don't need "javascript:" when using onclick
2) DIVs don't have .value attributes. You would use .innerHTML to use the code inside the DIV - .value is for form elements.
__________________
Will Work For Talkputation...
funkdaddu is offline
Reply With Quote
View Public Profile Visit funkdaddu's homepage!
 
Old 09-14-2006, 08:53 AM Re: idiots & getElementById
purk's Avatar
Extreme Talker

Posts: 164
Name: James
Location: marbella & surrey
cool, thanks
__________________
thatVilla.com - private villas direct from the owners - travel links always needed.
purk is offline
Reply With Quote
View Public Profile Visit purk's homepage!
 
Reply     « Reply to idiots & getElementById
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.12184 seconds with 12 queries