Document.Write in firefox

D

daniel.westerberg

Hi all,

got a strange problem with some code..
I have a frameset that is generated by the code below, and when
surfing to index.htm it works fine in both firefox and IE.

When surfing directly to a "subpage" it opens the frameset as it
should in IE and almost as it should in Firefox.
Except that in Firefox the frame wbasket isn't loaded (Just empty
html). If I press F5 the basket frame is shown as it should. Any ideas
on hos to fix this?

<SCRIPT LANGUAGE="JavaScript">
<!--
defaultsubpage="default.aspx";
if (location.search) {subpage=location.search.substring(1)}
else {subpage=defaultsubpage}

if (subpage.indexOf('&&&')>=0) {
prefix=subpage.substring(0,subpage.indexOf('&&&'))+"://";
suffix=subpage.substring(subpage.indexOf('&&&')+3,subpage.length);
subpage=prefix+suffix;
}
else
{
subpage='default.aspx';
}
document.write('<frameset cols="949,*" frameborder="NO" border="0"
framespacing="0">');
document.write('<frameset rows="111,*,40" frameborder="NO" border="0"
framespacing="0">');
document.write('<frame src="top.aspx" name="wtop" scrolling="NO"
noresize >');
document.write('<frameset cols="182,*" frameborder="NO" border="0"
framespacing="0">');
document.write('<frame style="padding-top:0px; margin:0px;"
src="menu.aspx" name="wmeny" scrolling="NO" noresize>');
document.write('<frame src="'+subpage+'" name="wmain" id="wmain"
scrolling=auto>');
document.write('</frameset>');
document.write('<frame src="cart.aspx" name="wbasket" id="wbasket"
scrolling="NO" noresize>');
document.write('</frameset>');
document.write('<frame src="empty.htm" name="wempty" scrolling="NO"
noresize >');
document.write('</frameset>');
// -->
</SCRIPT>
 
T

Thomas 'PointedEars' Lahn

When surfing directly to a "subpage" it opens the frameset as it
should in IE and almost as it should in Firefox.
Except that in Firefox the frame wbasket isn't loaded (Just empty
html). If I press F5 the basket frame is shown as it should. Any ideas
on hos to fix this?

<SCRIPT LANGUAGE="JavaScript">
^^^^^^ ^^^^^^^^^^^^^^^^^^^^^
See below.

It is not necessary and it is error-prone to try to "comment out" `script'
element contents.
[...]
document.write('<frameset cols="949,*" frameborder="NO" border="0" ^^^^^^^^
framespacing="0">');
document.write('<frameset rows="111,*,40" frameborder="NO" border="0"
framespacing="0">');
document.write('<frame src="top.aspx" name="wtop" scrolling="NO"
noresize >');
document.write('<frameset cols="182,*" frameborder="NO" border="0"
framespacing="0">');
document.write('<frame style="padding-top:0px; margin:0px;"
src="menu.aspx" name="wmeny" scrolling="NO" noresize>');
document.write('<frame src="'+subpage+'" name="wmain" id="wmain"
scrolling=auto>');

Eeek. Consider this:

document.write(new Array(
'...',
'...'
).join(""));
document.write('</frameset>'); ^^
document.write('<frame src="cart.aspx" name="wbasket" id="wbasket"
scrolling="NO" noresize>');

http://validator.w3.org/


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top