|
-
Jun 24th, 2001, 11:52 AM
#1
Thread Starter
Hyperactive Member
Changing the src of a frame using Javascript (newbie q)
I have two frames: a main body frame, and a bottom frame with buttons that are used to navigate amongst the pages. I want to make it so that when you click on a button in the button frame it will change the contents of the main frame. The frames are 'fraMain' and 'fraNavig'.
"There are only two things that are infinite. The universe and human stupidity... and the universe I'm not sure about." - Einstein
If you are programming in Java use www.NetBeans.org
-
Jun 24th, 2001, 12:21 PM
#2
set the target to the frame you want,
e.g. <a href="file.html" target="fraMain">
if this is not what you are after, can you show some code you are using?
-
Jun 24th, 2001, 12:25 PM
#3
Thread Starter
Hyperactive Member
I know how to do it in HTML but I was wondering if could do it in JavaScript.
basically the contents of fraNavig are bunch of
<input type = "button" name = "butMain" value="Main" onClick="">
It is in the onClick that I want to insert the change frame source. I need to do it in JavaScript for reasons I don't feel like explaining.
"There are only two things that are infinite. The universe and human stupidity... and the universe I'm not sure about." - Einstein
If you are programming in Java use www.NetBeans.org
-
Jun 24th, 2001, 12:48 PM
#4
sure I understand. you could do something like this
Code:
function load() {
parent.frames.top.location = "main.html";
}
onClick="load()">
see if that works
-
Jun 24th, 2001, 12:56 PM
#5
Thread Starter
Hyperactive Member
I don't see the part where I specify that I want this new page opened in "fraMain"...
All that code did was open up a pagethat replaced my frames page, but I just want to open the page into an existing frame
"There are only two things that are infinite. The universe and human stupidity... and the universe I'm not sure about." - Einstein
If you are programming in Java use www.NetBeans.org
-
Jun 24th, 2001, 02:04 PM
#6
sorry I thought it would go into the parent. ok try adding a .parent to the code, so it would be
parent.parent.frames
-
Jun 24th, 2001, 02:16 PM
#7
Member
Thnx for the help Scoutt, but I got it now. I took a look at an e-book and kinda hacked it out.
For anyone looking for good JavaScript info go:
http://home.netscape.com/eng/mozilla...ok/javascript/
For anyone who was following along here is the answer:
parent.window.XXXX.location = "http://YYYYY"
where XXXX is the frame name and YYYYY is the URL that you want to go to.
Visual Basic 6 Professional Edition
Captain Pinko
also:
Turbo Pascal, Turing, QBasic
-
Jun 24th, 2001, 02:19 PM
#8
oh crap, my bad. I see what I did
Code:
function load() {
parent.frames.fraMain.location = "main.html";
}
sorry that should work.
-
Jun 24th, 2001, 02:26 PM
#9
ya i forgot to change the name of the frame. I just took out of one of my pages and forgot to change it. I will also take a look at that page. thanks for the link.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|