Jump to content

JScript . InnerHTML , <a href..>


SunTzu

Recommended Posts

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...