Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > frames and navigation

frames and navigation
Thread Tools
Senior User
Join Date: Feb 2000
Location: Webster, NY, USA
Status: Offline
Reply With Quote
Aug 1, 2003, 04:25 PM
 
I am using a very tweaked version of ASP calendar. But my question is regarding frames in general:

I have three frames, a banner, a left navigation bar and a right info area.

In the left navigation bar I have a calendar. The top of it looks something like this

< August >

Where the <>'s are buttons to go forward/backward one month

here's the trick, I can, using the [a href] tag get either the left or right frame to change. What I want to know is whether or not I can, using frames, have it so that the left frame refreshed to the next month and the right frame displays the information for that month.

Right now it works where (depending how I set up the a tag) I can either get it so the left fram updates properly or I can set it up so that the right frame updates properly, but I don't know how to make it update both frams by pressing one button.

If anyone out there can help me, give me a javascript or the proper HTML code to do this I would be most grateful.

Thank you,

O
B unce!
     
Dedicated MacNNer
Join Date: Aug 2002
Status: Offline
Reply With Quote
Aug 1, 2003, 07:09 PM
 
you need to use javascript for this:

Code:
function changeFrames(frameOneName,frameOneHref,frameTwoName,frameTwoHref) { top.frames[frameOneName].location.href=frameOneHref; top.frames[frameTwoName].location.href=frameTwoHref; }
then your link looks like:

[a href="javascript:changeFrames('left','http://nextmonth.com','right','http://nextmonth.com/info')"]click[/a]

remember, use angly brackets

there may be some errors, I didn't test this code
--will
     
Registered User
Join Date: Jul 2003
Location: San Jose
Status: Offline
Reply With Quote
Aug 1, 2003, 07:10 PM
 
pheewwww, that was a fun little problem... i only used 2 frames, but you can easily change this to work with 3.

so here's the javascript that i came up with (it works in safari and ie for mac, didn't check netscape)

main page - snippet
[php]
<frameset rows="100, *">
<frame name="frame_1" src="page1.asp">
<frame name="frame_2" src="page2.asp">
</frameset>
[/php]
what's important here is that you give names to the frames (ie - name="frame_1"). you can name them whatever you want - just as long as you change it in the second page....

page1.asp
[php]
<html>

<head>

<script>

function frameSwitch(fr1, fr2) {
var frame1 = fr1;
var frame2 = fr2;

parent.frame_1.document.location.href = frame1;

parent.frame_2.document.location.href = frame2;

}

</script>

</head>

<body>

<a href="javascript:frameSwitch('page3.asp','page4.as p')">asdf</a>

</body>

</html>
[/php]
so, just change page3.asp and page4.asp to whatever you want those frame pages to change to and you should be good to go...

in this example:
page1.asp changes to page3.asp
page2.asp changes to page4.asp
     
Registered User
Join Date: Jul 2003
Location: San Jose
Status: Offline
Reply With Quote
Aug 1, 2003, 07:11 PM
 
whoops, will beat me to it....
     
Senior User
Join Date: Feb 2000
Location: Webster, NY, USA
Status: Offline
Reply With Quote
Aug 1, 2003, 07:20 PM
 
Thanks so much to the both of you. I will give this a try!

Peace,

O
B unce!
     
Senior User
Join Date: Feb 2000
Location: Webster, NY, USA
Status: Offline
Reply With Quote
Aug 1, 2003, 08:11 PM
 
hmmm....I can't seem to get this to work for me. I added an alert tag to the script that lets me know if teh script is running, and that isn't working either...

I am playing with the code as I type this, but if someone wants to go to cadca.org/calendar to see if they can look at the source and see if they know why my code isn't working feel free to do so.

FYI I am trying to get the left and right arrows next to the month name to be the code that causes the JavaScript to execute. I have changed the right arrow to the text test to see if that would help. I also changed the pages that are linked to see if I passed it different pages if that would help, but that didn't.

Peace,

O
B unce!
     
Registered User
Join Date: Jul 2003
Location: San Jose
Status: Offline
Reply With Quote
Aug 1, 2003, 08:15 PM
 
[php]<a href="java script:frameSwitch('events.asp', 'admin.asp')">test</a>[/php]

lose the spaces between java and script and events.asp and admin.asp... should be

[php]<a href="javascript:frameSwitch('events.asp','admin.a sp')">test</a>[/php]

EDIT: weird, i didn't notice that it did that before... it should be [a href="javascript... ]
     
Senior User
Join Date: Feb 2000
Location: Webster, NY, USA
Status: Offline
Reply With Quote
Aug 1, 2003, 08:18 PM
 
Originally posted by NDBounce:
hmmm....I can't seem to get this to work for me. I added an alert tag to the script that lets me know if teh script is running, and that isn't working either...
I found my error...in the href tag JavaScript is one word not two...

that seemed to fix it for me..

thanks all for the help
     
Registered User
Join Date: Jul 2003
Location: San Jose
Status: Offline
Reply With Quote
Aug 1, 2003, 08:26 PM
 
just checked your site out in ie4mac, safari, and netscape... all seem to be working fine...

cool stuff, i'm glad it worked out for ya....
(Last edited by mzllr; Aug 1, 2003 at 08:32 PM. )
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 02:15 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2