SunTzu Posted December 30, 2006 Share Posted December 30, 2006 Hi to All ,I have the following cell which is a hyperlink and i am trying to change its link using javascript ... <td class="menu" id="jobdesc" onmouseover="openmenu()"><a href="jobdescription.htm">Job Description</a></td> Here is the script: <script type="text/javascript">function openmenu() { document.getElementById("jobdesc").innerHTML = "<a href=\"why.htm\">Job Description</a>";}</script> But unfortunately the link seems to be inactive ... (file why.htm is there ) What can be wrong?thnx in advance. Link to comment Share on other sites More sharing options...
SunTzu Posted December 31, 2006 Author Share Posted December 31, 2006 Hi to All ,I have the following cell which is a hyperlink and i am trying to change its link using javascript ... <td class="menu" id="jobdesc" onmouseover="openmenu()"><a href="jobdescription.htm">Job Description</a></td> Here is the script: <script type="text/javascript">function openmenu() { document.getElementById("jobdesc").innerHTML = "<a href=\"why.htm\">Job Description</a>";}</script> But unfortunately the link seems to be inactive ... (file why.htm is there ) What can be wrong?thnx in advance. strange .... when i put onmouseover="openmenu()" in the <a> element works fine ... Link to comment Share on other sites More sharing options...
MrAdam Posted January 1, 2007 Share Posted January 1, 2007 a working alternate:java script: function openmenu() { var obj = document.getElementById('jobdesc'); obj.innerHTML = 'Job Description'; obj.href = 'why.htm';} html: <td class="menu" onmouseover="openmenu()"><a id="jobdesc" href="jobdescription.htm">Job Description</a></td> Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now