Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



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

Posts: 164
Name: James
Location: marbella & surrey
Trades: 0
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;
__________________

Please login or register to view this content. Registration is FREE
- private villas direct from the owners - travel links always needed.

Last edited by purk; 09-09-2006 at 10:24 AM..
purk is offline
Reply With Quote
View Public Profile Visit purk's homepage!
 
 
Register now for full access!
Old 09-09-2006, 11:55 PM Re: idiots & getElementById
funkdaddu's Avatar
Web Design Snob

Posts: 635
Trades: 0
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.
funkdaddu is offline
Reply With Quote
View Public Profile Visit funkdaddu's homepage!
 
Old 09-14-2006, 09:53 AM Re: idiots & getElementById
purk's Avatar
Extreme Talker

Posts: 164
Name: James
Location: marbella & surrey
Trades: 0
cool, thanks
__________________

Please login or register to view this content. Registration is FREE
- 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 Search this Thread
Search this Thread:

Advanced Search

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

BB 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.52137 seconds with 12 queries