sigmundSquirrel
12-19-2006, 03:15 AM
Okay, I understand javascript logic but I'm apparently not up on all the cross-browser issues. Can anyone look at this code and tell me why it works on a Mac (Safari and Firefox) but not on a PC (IE and Firefox)? Seems pretty simple and straightforward to me.
I've got a frameset with a Flash navigation in the top frame and HTML content loads into the bottom frame. I'm grabbing the URL querystring to dynamically write the correct HTML into the bottom frame. This works fine on a Mac but not PC so I assume I'm missing some strict syntax or something?
You can check the behavior out at:
http://www.poddesign.com/myvu2 (try it on Mac and PC)
Looks fine on Mac. If there is no querystring (i.e., the first hit) it defaults to "home" -- if you click to "Products" then back to "Buzz" you'll see the querystring in the location bar. When you try it on a PC, the bottom is just blank. If you click on the Flash menu, it will load a new window because there is no frameset named "content" to receive it (because it isn't being dynamically written by the javascript). Grrrr...
Here's the HTML code:
------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>myvu</title>
<!-- HERE"S THE CODE TO GRAB THE QUERYSTRING AND ASSIGN A PAGE VARIABLE TO BE DYNAMICALLY WRITTEN IN A FRAME BELOW -->
<script type="text/javascript">
var thispage="home";
var URL_array=new Array();
URL_array[1]="home";
URL_array[2]="whatsnew";
URL_array[3]="products";
URL_array[4]="accessories";
URL_array[5]="buzz";
URL_array[6]="media";
URL_array[7]="faq";
URL_array[8]="wheretobuy";
URL_array[9]="shoppingcart";
categoryID = top.location.search;
if (categoryID.charAt(0)=="?") {
categoryID = categoryID.slice(10);
thispage=URL_array[categoryID];
}
</script>
</head>
<frameset cols="*,1024px,*" frameborder="0" framespacing="0" border="0">
<frame src="bg_left.html" />
<frameset rows="400px,*" frameborder="0" framespacing="0" border="0">
<frame name="nav" src="main.html" scrolling="no" marginheight="0" marginwidth="0" frameborder="0" border="0" noresize="yes" />
<!-- HERE'S WHERE I DYNAMICALLY DOCUMENT.WRITE THE PAGE VARIABLE INTO THE FRAME -->
<script type="text/javascript">
document.write('<frame name="content" src="'+thispage+'.html" marginheight="0" marginwidth="0" frameborder="0" border="0" noresize="yes" />');
</script>
</frameset>
<frame src="bg_right.html" />
</frameset>
</html>
---------------------------------
Any help out there?
Thanks,
sigmundsquirrel
I've got a frameset with a Flash navigation in the top frame and HTML content loads into the bottom frame. I'm grabbing the URL querystring to dynamically write the correct HTML into the bottom frame. This works fine on a Mac but not PC so I assume I'm missing some strict syntax or something?
You can check the behavior out at:
http://www.poddesign.com/myvu2 (try it on Mac and PC)
Looks fine on Mac. If there is no querystring (i.e., the first hit) it defaults to "home" -- if you click to "Products" then back to "Buzz" you'll see the querystring in the location bar. When you try it on a PC, the bottom is just blank. If you click on the Flash menu, it will load a new window because there is no frameset named "content" to receive it (because it isn't being dynamically written by the javascript). Grrrr...
Here's the HTML code:
------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>myvu</title>
<!-- HERE"S THE CODE TO GRAB THE QUERYSTRING AND ASSIGN A PAGE VARIABLE TO BE DYNAMICALLY WRITTEN IN A FRAME BELOW -->
<script type="text/javascript">
var thispage="home";
var URL_array=new Array();
URL_array[1]="home";
URL_array[2]="whatsnew";
URL_array[3]="products";
URL_array[4]="accessories";
URL_array[5]="buzz";
URL_array[6]="media";
URL_array[7]="faq";
URL_array[8]="wheretobuy";
URL_array[9]="shoppingcart";
categoryID = top.location.search;
if (categoryID.charAt(0)=="?") {
categoryID = categoryID.slice(10);
thispage=URL_array[categoryID];
}
</script>
</head>
<frameset cols="*,1024px,*" frameborder="0" framespacing="0" border="0">
<frame src="bg_left.html" />
<frameset rows="400px,*" frameborder="0" framespacing="0" border="0">
<frame name="nav" src="main.html" scrolling="no" marginheight="0" marginwidth="0" frameborder="0" border="0" noresize="yes" />
<!-- HERE'S WHERE I DYNAMICALLY DOCUMENT.WRITE THE PAGE VARIABLE INTO THE FRAME -->
<script type="text/javascript">
document.write('<frame name="content" src="'+thispage+'.html" marginheight="0" marginwidth="0" frameborder="0" border="0" noresize="yes" />');
</script>
</frameset>
<frame src="bg_right.html" />
</frameset>
</html>
---------------------------------
Any help out there?
Thanks,
sigmundsquirrel