<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<script type="text/javascript">
var myLinks = ["http://www.google.com", "http://www.yahoo.com"];
var myTexts = ["Google", "Yahoo"];
var k = 0;
function chgLink(x)
{
k = (k == 2)? 0 : k;
var el = document.getElementById('ta');
alert(el.rows[0].cells[0].innerHTML);
alert(el.rows[0].cells[0].title);
alert(el.rows[0].cells[0].href);
el.rows[0].cells[0].innerHTML = myTexts[k];
el.rows[0].cells[0].title = myTexts[k];
el.rows[0].cells[0].href = myLinks[k];
k++;
}
</script>
</head><body>
<table border="1" id="ta">
<tr><td>
<a id="1" href="">Test</a>
</td></tr>
</table>
<form>
<input type="button" onclick="chgLink(1)" value="Test Change">
</form></body></html>
Thanks for you reply, I tried your code it works, but if there is no Id for the link element, and if I want to change it through the table ID, it is not working.
I have pasted the modified code, Can you pls check and tell me why its not working now..
Using IE6 only
|