easyeman
Active member
I usually don't like frames but I have to use it for some reason in this assignment I'm doing.
I am trying to change a link on another frame (main.html) by a user clicking a button on another frame (header.html). I'm using DOM Javascript to do it, and I think I have how it should go except it's not working because I guess it is a different frame. How would I go about doing this and having it link? I'm stuck on what to do though it should be simple. Can anyone help me out?
Here's what I have for the script header:
This is on the main page which will be changed:
I am trying to change a link on another frame (main.html) by a user clicking a button on another frame (header.html). I'm using DOM Javascript to do it, and I think I have how it should go except it's not working because I guess it is a different frame. How would I go about doing this and having it link? I'm stuck on what to do though it should be simple. Can anyone help me out?
Here's what I have for the script header:
HTML:
<script type="text/javascript">
function changeLink()
{
document.getElementById('myAnchor').innerHTML="New Web Site"
document.getElementById('myAnchor').href="http://www.newsite.com"
}
</script>
<input type="button" onclick="changeLink()" value="Change link to new site" />
This is on the main page which will be changed:
HTML:
<span style="font-size:11pt; color:red; font-family:Arial; font-weight:bold">Be sure
to visit <a id="myAnchor" href="http://www.nfpa.org" target="_blank">this official site.</a></span>