Forum Moderators: open

Message Too Old, No Replies

Open a page in the main frame of frameset, with a link on another page?

         

hikazechan

2:47 am on Oct 3, 2006 (gmt 0)

10+ Year Member



Hello everyone ^.^

I have a problem, ive been searching this for so long but still can't find the solution...

I have two pages:
page1 and page2

in page1 there's a link where when you click it, a pop-up window will appear[page2].
Where a pop-up window is divided into two frames: contents frame and mainframe

what i want to do?
1. when you click the link [page1], you will automatically in the specific page[page2] in mainframe no need for you to click any links in the contents frame. eh? getz?

please help.... ASAP

thank you.

tedster

4:25 am on Oct 3, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I assume you want this frameset in a pop-up to be able to load many different urls into its content frame, right? If so, you can accomplish this with a variation of the javascript found in our Generic Javascript thread [webmasterworld.com].

Scroll down to Message #:1475958 with the title "FORCE MANY PAGES INTO FRAMES with one simple script".

Your pop-up links will link directly to the content url, not the frameset url. And then the script on each individual content page will take the url from the pop-up anchor tag and insert it into content frame of the "master" frameset.

hikazechan

2:45 am on Oct 4, 2006 (gmt 0)

10+ Year Member



amm Tedster, thanx for your help but if you don't mind can you please explain those codes in a greater detail? im just newbie in js

where i put this code?

passpage = document.URL
if (top.location == self.location)
top.location.href="master.html?" + passpage

what is passpage?
document.URL = do i have to replace the word URL with the right url (ex. example.html)? eh.. please don't get mad at me... yeah i'm such naive

what im going to do with this one?
===============================================================
origURL = parent.document.URL
contentURL = origURL.substring(origURL.indexOf('?')+1, origURL.length)

document.write('<frameset cols="20%,80%"><frame src="leftnav.html" name="nav"><frame src=\"' + contentURL + '\" name="content"><\/frameset>')
===============================================================

just copy as it is? or replace the word "origURL" with the right url? and how should i know what is the origURL? is that the "master.html" (based from your example)

contentURL? just copy as it it or replace?

im confused with this code <frame src=\"' + contentURL + '\" name="content"><\/frameset>')

meaning in
+contentURL+ ---------- i should code the right url for contentURL (ex. content.html)?

if that would be the case "contentURL" is the mainframe, the 80%?
and the "leftnav.html" is the 20%? and that's where all the links located? (just imagine the "HELP" or the tutorial appearance in adobe photoshop/ macromedia) something like that...

oh please bear with me...

thank you very much

tedster

3:30 am on Oct 4, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This solution is probably simpler than you think. For instance, you don't need to plug in any specific urls yourself, the script makes those subsitutions work for you. It grabs the urls from the browser's information about the urls it is displaying.

If you are struggling with basic javascript syntax -- for instance, what terms are native to all javascript and what are just variable names that I defined for this one specific case -- then I'd suggest you spend just a few hours learning those basics. W3Schools is a good resource for this. Then come back to work with this script.

And please trust me, I'm far from a javascript ace and I wrote this script myself. It's one of just a handful that I ever wrote! Adding just a little bit of javascript to your personal toolkit is a really good thing -- you will suffer much less copy and paste slavery.

The other thing I'd suggest you do after you have the very basics of js under your belt, is to take my code and experiment with some html pages to see what happens. There's nothing like hands-on work to make something new really gel.

Here's the link for W3Schools tutorials: [w3schools.com...]