/    Sign up×
Community /Pin to ProfileBookmark

Setting the mainFrame to url.

I have very limited use of JS and need some help.

I need to link a site on the web to my mainFrame in the frameSet, with out hitting a button (so when the person opens my frameSet it loads the site in my mainFrame). The code bellow works in some browsers but not all… and I need to work in all browsers. Are there better lines of code to use? Or how can I change this to work in every browser…

var frameSRC
if (location.search)
frameSRC = location.search.substring(1)
else
frameSRC = “The Page I want to Show”

document.write(‘<FRAMESET “rows=”40,592*” cols=”157″ frameborder=”no”>’)
document.write(‘<FRAME SRC=”topnav_frame.html”>’)
document.write(‘<FRAME SRC=”‘ + frameSRC + ‘” name=”mainFrame”>’)
document.write(‘</FRAMESET>’)

to post a comment
JavaScript

8 Comments(s)

Copy linkTweet thisAlerts:
@A1ien51Jul 31.2008 — Does not work does not tell us anything.

Does not work in some browsers does not tell us anything.

Better details = better answers.

Eric
Copy linkTweet thisAlerts:
@Dan_MimauthorAug 01.2008 — This code works perfectly in safari and firefox, but not in opera or "IE mac"
Copy linkTweet thisAlerts:
@Dan_MimauthorAug 04.2008 — Up! ?

This code works perfectly in safari and firefox, but not in opera or '"IE"'
Copy linkTweet thisAlerts:
@A1ien51Aug 04.2008 — What is the problem....Is there an error. Does the world explode? As I stated it works and does not work does not give us details to help you get an answer.

Personally you would be better off doing this at a serverside level than the clientside.

Eric
Copy linkTweet thisAlerts:
@Dan_MimauthorAug 04.2008 — Setting the mainframe to a url with this set of code doesnt work in IE or Opera It doesnt show the url that is targeted to the mainFrame(the second frame).

My question is, is there a better line of code to "link" external websites to a frame? with out an anchor tag... like this.

http://www.cerc.com/eddi/frame/?http://www.locationone.com/lois/logon.do?username=CT-CERC&appsection=states&state_cd=CT

The website shown and the menu up top are in 2 different frames... and the website shown in the second frame is linked to the second frame...

i dont know how to be any clearer. Im not a coder i dont know how to really explain what the problem is when i dont know what the problem is.
Copy linkTweet thisAlerts:
@slaughtersAug 04.2008 — At a guess - his problem is that search engines hit his "main page" and it pulls up with out the main navigation frame around it. A standard problem when using framesets.

Dan_mim - The technique you are using comes from the IRT.ORG site. They have a page there which states how to get it to work with mac IE (the 5 or 7 people who are using that browser) and Opera (the 1 or 2 hundred who are using that browser)

http://www.irt.org/articles/js190/index.htm
Copy linkTweet thisAlerts:
@Dan_MimauthorAug 04.2008 — thank you for the ref, but it all so doesnt work with the pc version of IE... will that help all the same?
Copy linkTweet thisAlerts:
@Dan_MimauthorAug 07.2008 — GREAT! IT WORKS! lol thank you so much ?

Great! Link
×

Success!

Help @Dan_Mim spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...