Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 how to change iframe url dynamicly in NN & opera?
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

bjlt
Senior Member

1144 Posts

Posted - 14 September 2003 :  18:02:52  Show Profile
title edited to better explain my question.


This is a question on js. I want to change the url of a inframe by clicking a link. codes below:


<html>
<head>
</head>
<body>
<script>
function change()
{
  if(document.getElementById)
  {
    document.BF.document.location=("test5.html");
  }
}
</script>
<a href="javascript:change()">Change</a>

<iframe width=100 height=100 FRAMEBORDER=1 src="test4.html" id="BF" name="BF"></iframe>
</body>
</html>


However, such codes don't work in NN, also, in Opera it will load the new link in the top window instead of in the frame.

How to code it for compatibility of NN6+/Mozilla and Opera?

Thanks in advance.

Edited by - bjlt on 14 September 2003 18:35:37

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 14 September 2003 :  18:09:29  Show Profile
maybe I'm just not seeing it, but you aren't using document.location.replace ??? also, you can try window.location.replace instead (my reference says this is what is preferred for W3C).

Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~
Go to Top of Page

bjlt
Senior Member

1144 Posts

Posted - 14 September 2003 :  18:27:00  Show Profile
Thank you Nikkol.

yeah, I've tried several ways of writing it
location=
location.replace,
src=
url=
localtion.href=
etc.
none works.
I'm not good at js and can't figure out what's wrong there.

Will window.location.replace work on a iframe?

I'm testing it.
Go to Top of Page

bjlt
Senior Member

1144 Posts

Posted - 14 September 2003 :  18:39:14  Show Profile
document.BF.document.location=("test5.html");

changed to

objBF=document.getElementById? document.getElementById("BF") : document.all.BF
objBF.src=("test5.html")

and now it works in NN.

Thanks.

Edited by - bjlt on 14 September 2003 18:40:36
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.31 seconds. Powered By: Snitz Forums 2000 Version 3.4.07