Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dynamic alocation of "src" value through java script - help please

Status
Not open for further replies.

meenu24

Programmer
May 5, 2006
37
US
Hi
I have a row in the table.
<td><a href="somevalue1"><img src="somevalue2"></td>
Is it possible to write a java script to dynamically change the value of href and src. i.e I have program when mouseover on a certain row, the values of the above href and src must be decided by the java script. Can this be done by javascript.(how to identify a href and src of this td and pass the value through java script)

Please help me. I am really wondering how to do this.

Thanks for any suggestion
 
Code:
[!]
<script type="text/javascript">
function changeValues() {
   document.getElementById("myLink").href = "someothervalue1";
   document.getElementById("myImage").src = "someothervalue2
}
</script>
[/!]
<td>
   <a href="somevalue1" [!]id="myLink"[/!]>
      <img src="somevalue2" [!]id="myImage"[/!] />
   </a>[gray]<!--remember to close your anchors-->[/gray]
</td>

-kaht

[small]How spicy would you like your chang sauce? Oh man... I have no idea what's goin' on right now...[/small]
[banghead]
 
Thanks a lot Khant. I would definitely try this

regards

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top