Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > dynamic write of frameset

Reply
Thread Tools

dynamic write of frameset

 
 
Alain Bourgeois
Guest
Posts: n/a
 
      11-11-2007
Dear all,


I'm new to javaScript. I would like to know why this code does not work:

<html>
<head></head>

<frameset cols="200,*" frameborder="1">
<frame name="contents" src="menu.htm">
<script language="JavaScript1.1" type="text/javascript">
document.write("<frame name=\"prod\" src=\"prod01.htm\">");
</script>
</frameset>

</html>


I would like to pass a parameter to the html page (in url) which would
tell me which html src to use in the "prod" frame, but scripts doesn't
seem to run (nor to be run) in frameset section.

(http://prod01site.com would be redirected to
http://myglobalsite.com/index.html?product="prod1.htm", and would load
prod1.htm into "prod" frame).

Is there a way to do this?


Regards,
Alain
 
Reply With Quote
 
 
 
 
Darko
Guest
Posts: n/a
 
      11-12-2007
On Nov 12, 12:22 am, Alain Bourgeois <brolspa...@skynet.be> wrote:
> Dear all,
>
> I'm new to javaScript. I would like to know why this code does not work:
>
> <html>
> <head></head>
>
> <frameset cols="200,*" frameborder="1">
> <frame name="contents" src="menu.htm">
> <script language="JavaScript1.1" type="text/javascript">
> document.write("<frame name=\"prod\" src=\"prod01.htm\">");
> </script>
> </frameset>
>
> </html>
>
> I would like to pass a parameter to the html page (in url) which would
> tell me which html src to use in the "prod" frame, but scripts doesn't
> seem to run (nor to be run) in frameset section.
>
> (http://prod01site.comwould be redirected tohttp://myglobalsite.com/index.html?product="prod1.htm", and would load
> prod1.htm into "prod" frame).
>
> Is there a way to do this?
>
> Regards,
> Alain


Seems that there is not. See HTML standard. For an example, BODY tag
definition says:

<!ELEMENT BODY O O (%block;|SCRIPT)+ +(INS|DEL) -- document body -->

where %block may be any of the block elements (div, table, paragraph,
etc.), and as you see SCRIPT is
allowed as well. Now let's take a look at the FRAMESET definition:

<!ELEMENT FRAMESET - - ((FRAMESET|FRAME)+ & NOFRAMES?) -- window
subdivision-->

Only inner framesets, frames and noframes' are allowed. No mention of
SCRIPT.

Sorry

 
Reply With Quote
 
 
 
 
pr
Guest
Posts: n/a
 
      11-12-2007
Alain Bourgeois wrote:
> I'm new to javaScript. I would like to know why this code does not work:
>
> <html>
> <head></head>
>
> <frameset cols="200,*" frameborder="1">
> <frame name="contents" src="menu.htm">
> <script language="JavaScript1.1" type="text/javascript">
> document.write("<frame name=\"prod\" src=\"prod01.htm\">");
> </script>
> </frameset>
>
> </html>
>
>
> I would like to pass a parameter to the html page (in url) which would
> tell me which html src to use in the "prod" frame, but scripts doesn't
> seem to run (nor to be run) in frameset section.
>
> (http://prod01site.com would be redirected to
> http://myglobalsite.com/index.html?product="prod1.htm", and would load
> prod1.htm into "prod" frame).
>
> Is there a way to do this?
>


You could update the frame's location once the frameset loaded:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title>frameset</title>
<script type="text/javascript">
function setProduct() {
var page = self.location.search.match(/[\?&]product=([^&]+)/)[1];
self.frames["prod"].location = page;
}
</script>
</head>
<frameset cols="200,*" onload="setProduct()">
<frame name="contents" frameborder="1" src="menu.htm">
<frame name="prod" frameborder="1" src="about:blank">
</frameset>
</html>

.... but you'd almost always be better off doing this kind of thing on
the server.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting 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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing to a frameset causes the frameset to resize xzzy ASP .Net 4 03-23-2006 10:31 PM
How to leave a frameset for opening a new frameset with a JavaScript Stefan Mueller Javascript 0 11-07-2005 09:44 AM
Frameset, Selected Index, Target Frameset relchatt@comcast.net ASP .Net 0 09-29-2004 09:37 PM
Changing src of a frame of a frameset within another frameset? Julius Mong Javascript 1 05-10-2004 07:35 PM
How do you make sure a frameset is loaded? I'm trying to open a frameset in a new window which shows a specific html page in a specific frame ck388 Javascript 1 09-24-2003 08:32 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57