WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-20-2005, 06:10 AM
pagetta's Avatar
pagetta pagetta is offline
WebProWorld Veteran
 

Join Date: Nov 2004
Location: UK
Posts: 504
pagetta RepRank 2
Default controlling frameset with javascript

I am building a site, and when skipping to active content it goes to a part of the site that is in a frameset. What i need to happen is, depending on which product you are signing up for for the appropriate page to load in the lower frame.

this is my frameset code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title>M-Science SMS Server</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../styles/pc_ie.css" rel="stylesheet" type="text/css">
<frameset rows="235,*" cols="*" framespacing="0" frameborder="NO" border="0">
<frame src="header.html" name="topFrame" scrolling="no" noresize >
<frame src="signup.html" name="mainFrame" frameborder="no" marginwidth="0" marginheight="0">
</frameset><noframes></noframes>

</head>

<body align="center">
</body>
</html>


signup.html is just a test page, but I want this frame to depend on where the user has just navigated from. What javascript shoul I use to do this? I have not used javascript much so if you could explain in simple terms I would really appreciate it!

Thanks in advance for any help!
Reply With Quote
  #2 (permalink)  
Old 06-20-2005, 08:50 AM
ADAM Web Design's Avatar
ADAM Web Design ADAM Web Design is offline
WebProWorld 1,000+ Club
 

Join Date: Dec 2003
Location: Toronto, Ontario, Canada
Posts: 2,217
ADAM Web Design RepRank 0
Default

You don't actually have to use Javascript at all to navigate the frameset. All you really need to use is the target attribute of your <a> tag.

For example, if you put <a href="someotherpage.html" target="mainFrame"> somewhere in your header.html page, it will load someotherpage.html into the mainFrame target.
Reply With Quote
  #3 (permalink)  
Old 06-20-2005, 08:56 AM
pagetta's Avatar
pagetta pagetta is offline
WebProWorld Veteran
 

Join Date: Nov 2004
Location: UK
Posts: 504
pagetta RepRank 2
Default

I'm not sure that would work in my case. what we have are three products, and when you sign up for a product, you click on the 'sign up' button, this navigates to a frameset, with an upper and lower frame. All the active content is in the lower frame. Depending which product you are signing up for, I want the appropriate page to load in the lower frame.

So if I clicked 'sign up' on product A, for example, what link would I use? How would using this 'mainFrame' target tell the frameset what to load in the lower half of the page?

Sorry - I am new to javascript a little more detail would be great.

Thank you
Reply With Quote
  #4 (permalink)  
Old 06-20-2005, 10:31 AM
speed speed is offline
WebProWorld Veteran
 

Join Date: Aug 2003
Location: Cornwall, UK
Posts: 823
speed RepRank 1
Default

I'm not sure I'm reading this right, but if the product selection is a form then you should be able add a target attribute to the <form> as ADAMWebDesign showed for a link.

If you go the JavaScript route then people will need to have JS enabled on their browsers so that they can use the sign up form, in which case:

a) How are you going to deal with those that choose to have JS disabled?

b) More importantly how are you going to meet Guideline 6.3 of WAI (http://www.w3.org/TR/WAI-WEBCONTENT/#tech-scripts) which requires pages work without client side scripting.

If you can't use frames the way ADAMWebDesign described, wouldn't it be better to use server side scripting to achieve the functionality you require?

Sites are supposed to be accessible now days.
__________________
TOLRA Micro Systems Limited US & UK Web Hosting with Continuous Data Protection
Web Directory : Web Directory Script
Reply With Quote
  #5 (permalink)  
Old 06-22-2005, 10:06 AM
pagetta's Avatar
pagetta pagetta is offline
WebProWorld Veteran
 

Join Date: Nov 2004
Location: UK
Posts: 504
pagetta RepRank 2
Default

Right - let me try and explain:
Our new site is NOT built using frames, however we have a large amount of active content. As soon as you navigate to ANY active content, you are hosted by a different server, and the page looks the same, but IS in frames, with a header and lower frame.
(Active content is 3 different sign in/registration pages, plus different log-ins depending on what product you have.)

What I want is for the frameset to recognise the referrer and depending on what the referrer is, to load the appropriate page in the lower frame.
I assumed this wouldn't be that difficult - I thought on the link TO the active content I could use a file.html?name=blahand then use some javascript in the frameset to tell it to use the name section (or similar) to load the appropriate page in the lower frame.

I don't see how a <target> attribute can work when I am not already in a frameset? I will be going from no frames, to frames, and want the lower frame to be dependant on where the user has just navigated from.
Any ideas?
Reply With Quote
  #6 (permalink)  
Old 06-22-2005, 10:10 AM
ADAM Web Design's Avatar
ADAM Web Design ADAM Web Design is offline
WebProWorld 1,000+ Club
 

Join Date: Dec 2003
Location: Toronto, Ontario, Canada
Posts: 2,217
ADAM Web Design RepRank 0
Default

Okay, I think I see what you mean. Basically, you want a customized page loaded into the lower frame based on the referrer.

Again, I don't think you need to use Javascript. Something like this would work:

<frame src="some_page_of_database_driven_content.asp?name =someone"></frame>

And use server-side programming to customize the content of the frame.
Reply With Quote
  #7 (permalink)  
Old 06-28-2005, 10:36 AM
pagetta's Avatar
pagetta pagetta is offline
WebProWorld Veteran
 

Join Date: Nov 2004
Location: UK
Posts: 504
pagetta RepRank 2
Default

this is what I needed:
http://www.quirksmode.org/js/framecustom.html

apologies if this is what you meant! But hope this can help someone else too :-)
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Tags: controlling, frameset, javascript



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



Search Engine Friendly URLs by vBSEO 3.0.0