473,480 Members | 2,048 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

JS code inside frameset..


can u put JS code inside a frameset? I have this, and it's not working,
even test alerts are ignored, in both browsers.. thank you..
Frances Del Rio
<frameset rows="90,*" border=0 frameborder="0" framespacing="0">
<frame name="header" src="header.html" scrolling="no" frameborder="0">
<script language="Javascript">
if(navigator.appName == "Netscape"){
alert('ha')
document.write("<frameset cols='120,*' frameborder='0' framespacing='0'>")
}
else {
alert('ha')
document.write("<frameset cols='112,*' frameborder='0' framespacing='0'>")
}
</script>

<frame name="nav" src="menu.html" scrolling="no" frameborder="0">
<frame name="main" src="check_puid.jsp" scrolling="auto" frameborder="0">
</frameset>

Jul 23 '05 #1
8 2714
Ron
Frances Del Rio wrote:

can u put JS code inside a frameset? I have this, and it's not
working, even test alerts are ignored, in both browsers.. thank you..
Frances Del Rio
<frameset rows="90,*" border=0 frameborder="0" framespacing="0">
<frame name="header" src="header.html" scrolling="no" frameborder="0">
<script language="Javascript">
if(navigator.appName == "Netscape"){
alert('ha')
document.write("<frameset cols='120,*' frameborder='0'
framespacing='0'>")
}
else {
alert('ha')
document.write("<frameset cols='112,*' frameborder='0'
framespacing='0'>")
}
</script>

<frame name="nav" src="menu.html" scrolling="no" frameborder="0">
<frame name="main" src="check_puid.jsp" scrolling="auto" frameborder="0">
</frameset>

script elements are not allowed in frameset elements ->
http://www.w3.org/TR/html401/present....html#h-16.2.1 . Put your
script in the head element instead.
Jul 23 '05 #2
bummer........
script elements are not allowed in frameset elements ->
http://www.w3.org/TR/html401/present....html#h-16.2.1 . Put your
script in the head element instead.
well, that's not of much use to me.. I need one frame with for Netscape
(N 4.7, I'm talking, hence the problem..) and another width for same
frame in IE.. thank you yr response.. Frances

Frances Del Rio wrote:

can u put JS code inside a frameset? I have this, and it's not
working, even test alerts are ignored, in both browsers.. thank you..
Frances Del Rio
<frameset rows="90,*" border=0 frameborder="0" framespacing="0">
<frame name="header" src="header.html" scrolling="no" frameborder="0">
<script language="Javascript">
if(navigator.appName == "Netscape"){
alert('ha')
document.write("<frameset cols='120,*' frameborder='0'
framespacing='0'>")
}
else {
alert('ha')
document.write("<frameset cols='112,*' frameborder='0'
framespacing='0'>")
}
</script>
<frame name="nav" src="menu.html" scrolling="no" frameborder="0">
<frame name="main" src="check_puid.jsp" scrolling="auto" frameborder="0">
</frameset>


Jul 23 '05 #3
Frances Del Rio wrote:
bummer........
?
> script elements are not allowed in frameset elements ->
> http://www.w3.org/TR/html401/present....html#h-16.2.1 . Put your
> script in the head element instead.


well, that's not of much use to me..


It is. Since you cannot use the "script" element within the "frameset"
element, but you *can* use it within the "head" element, you should do so.
See <40**************@PointedEars.de>.
[Top post]


Please take heed of <http://jibbering.com/faq/#FAQ2_3>.
PointedEars
Jul 23 '05 #4
Lee
Frances Del Rio said:

bummer........
script elements are not allowed in frameset elements ->
http://www.w3.org/TR/html401/present....html#h-16.2.1 . Put your
script in the head element instead.


well, that's not of much use to me.. I need one frame with for Netscape
(N 4.7, I'm talking, hence the problem..) and another width for same
frame in IE.. thank you yr response.. Frances


Tested in Netscape 7 and IE6:

<html>
<head>
<script type="text/javascript">
var cols=(navigator.appName == "Netscape")?120:112;
var html=[
'<frameset rows="90,*" border=0 frameborder="0" framespacing="0">',
'<frame name="header" src="header.html" scrolling="no" frameborder="0">',
"<frameset cols='"+cols+",*' frameborder='0' framespacing='0'>",
'<frame name="nav" src="menu.html" scrolling="no" frameborder="0">',
'<frame name="main" src="check_puid.jsp" scrolling="auto" frameborder="0">',
'</frameset></frameset>'
];
document.write(html.join(""));
</script>
</head>
</html>

Jul 23 '05 #5
Lee wrote:
var cols=(navigator.appName == "Netscape")?120:112;
var html=[
'<frameset rows="90,*" border=0 frameborder="0" framespacing="0">',
'<frame name="header" src="header.html" scrolling="no" frameborder="0">',
"<frameset cols='"+cols+",*' frameborder='0' framespacing='0'>",
'<frame name="nav" src="menu.html" scrolling="no" frameborder="0">',
'<frame name="main" src="check_puid.jsp" scrolling="auto" frameborder="0">',
'</frameset></frameset>'
];
document.write(html.join(""));


Nice one. But as for legibility of the resulting code, one should rather use

document.write(html.join("\n"));

And note that Array object initializers are not supported by all script
engines, so you may want to use

var html = new Array(
...
);

as well. However, browser sniffing does not work:

<http://pointedears.de/scripts/test/whatami>
PointedEars
Jul 23 '05 #6
On Fri, 28 May 2004 23:31:21 +0200, Thomas 'PointedEars' Lahn
<Po*********@nurfuerspam.de> wrote:
Nice one. But as for legibility of the resulting code, one should rather use

document.write(html.join("\n"));


I'd recommend "" - the fewer redundant nodes you have in the DOM the
better - why would you be reading generated code anyway?

Jim.
--
comp.lang.javascript FAQ - http://jibbering.com/faq/

Jul 23 '05 #7
Lee
Thomas 'PointedEars' Lahn said:

Lee wrote:
var cols=(navigator.appName == "Netscape")?120:112;
var html=[
'<frameset rows="90,*" border=0 frameborder="0" framespacing="0">',
'<frame name="header" src="header.html" scrolling="no" frameborder="0">',
"<frameset cols='"+cols+",*' frameborder='0' framespacing='0'>",
'<frame name="nav" src="menu.html" scrolling="no" frameborder="0">',
'<frame name="main" src="check_puid.jsp" scrolling="auto" frameborder="0">',
'</frameset></frameset>'
];
document.write(html.join(""));


Nice one. But as for legibility of the resulting code, one should rather use

document.write(html.join("\n"));

And note that Array object initializers are not supported by all script
engines, so you may want to use

var html = new Array(
...
);

as well. However, browser sniffing does not work:

1. During testing, I did join a newline, and alerted the result.
I changed it to "" and deleted the alert for release.

2. This is probably the first time I've used browser sniffing,
and did so only because the OP's requirement was to have a
different frame size in Netscape, specifically. Personally,
I would try to avoid such a requirement.

Jul 23 '05 #8
Jim Ley wrote:
[...] Thomas 'PointedEars' Lahn [...] wrote:
Nice one. But as for legibility of the resulting code, one should
rather use

document.write(html.join("\n"));
I'd recommend "" - the fewer redundant nodes you have in the DOM the
better -


Generally, agreed. But it is unlikely that someone
will access the top frameset element with the DOM.
why would you be reading generated code anyway?


To see that it worked.
PointedEars
Jul 23 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
3525
by: Hans | last post by:
Hi There, I have a page that has links with some variables and I need to open the results set in a frameset. I have tried doing this in various different ways, but still cannot get the variable...
1
2419
by: Mark Kuiphuis | last post by:
Now I have a question myself :) I am working on a website for a Hotel and on the first page we have a flash movie that shows the latest news items. The news items are retrieved from the database...
2
5066
by: luu duong | last post by:
I know this is probably easy but here is the details. I have an asp page that is not inside a frameset. I want to post data to another asp page that is inside a frameset. So firstpage.asp has...
1
10975
by: JP | last post by:
Hi, How can I create a dynamic frameset whose content changes based on user inputs? Specifically, how do I toggle a frame within a frameset? How can I allow a user to "close" or "dock" a...
13
52137
by: Andrew C. | last post by:
Hello, I am in the process of trying to make some existing web pages comply with W3C's HTML 4.01 Recommendation ('strict' where possible, 'loose' where not -- i.e. when using framesets and,...
1
1706
by: Hartmut Dippon | last post by:
Hello, does anybody know how I can access and modify properties of my frameset within my code behind class, or is that not possible at all? I tried to find anything in the internet about this...
2
3915
by: Pat Sheen | last post by:
In IE6 I'm using the following html to have three frames. One of the frames is to open a locally stored MS Word document. <frameset rows="100,1*"> <frame name=SiteHdr...
6
4335
by: BillE | last post by:
I have an aspx page which contains a frameset. I want to set the location.href of the frames dynamically using javascript created in the Page_Load of the frameset using RegisterStartupScript, but...
0
7310
by: joeller | last post by:
On October 13, 2006 Mark Rae wrote Hi, Firstly, I have not the slightest intention of using framesets - the reason for this post is merely to ask for assistance in furthering my understanding of...
0
7033
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6903
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7071
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
6861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5318
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4468
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2987
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2974
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
170
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.