OZONE Asylum
Forums
XML - XSL - XSLT - XHTML - CSS - DOM
changing image src using dom
This page's ID:
23831
Search
QuickChanges
Forums
FAQ
Archives
Register
Edit Post
Who can edit a post?
The poster and administrators may edit a post. The poster can only edit it for a short while after the initial post.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
Now it doesn't work at all (when I click the button, I get a javascript error) :confused: In IE 6.0 using either of those methods I get:[quote]error: 'document.getElementById(...)' is null or not an object[/quote]In FireFox 1.0 with either method I get [quote]Error: imageLine is not defined[/quote]If I use firefox's DOM inspector, and search for "imageLine" it finds it... Here's my javascript, with the 3 methods I tried: [code]<script type="text/javascript"> <!-- function updateLine(data) { // poi for the following: //document.getElementById( idOfYouImage ).src = 'new/source'; //document.getElementById( idOfYouImage ).setAttribute( 'src', 'new/source' ); //update image with new values //poi #1 // document.getElementById(imageLine).src = 'images/drawline.php?x1=' + // data.x1.value + '&y1=' + data.y1.value + '&x2=' + data.x2.value + // '&y2=' + data.y2.value; //poi #2: quote 'better way' document.getElementById(imageLine).setAttribute('src', 'images/drawline.php?x1=' + data.x1.value + '&y1=' + data.y1.value + '&x2=' + data.x2.value + '&y2=' + data.y2.value); // oldest way // document.images.imageLine.src = 'images/drawline.php?x1=' + // data.x1.value + '&y1=' + data.y1.value + '&x2=' + // data.x2.value + '&y2=' + data.y2.value; } --> </script>[/code]
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »