Javascript cross-browser compatibility question

by Ed Lazor <osmosis(at)atfantasy.com>

 Date:  Fri, 29 Sep 2000 18:17:55 -0700
 To:  hwg-style(at)hwg.org
  todo: View Thread, Original
I'll enclose the script at the bottom.  It works in both IE (5.5) and 
Netscape (4.72) until I remove the closing and starting <script> commands 
located towards the middle of the code.  Any ideas why?

-Ed

----------------------------------------------------------------

<script LANGUAGE="JavaScript">
<!--

	/*----------------------------------------------------
	// Browser Detect
	//--------------------------------------------------*/

	// Since this whole javascript shouldn't load unless client is using a
	//   DHTML-capable "Mozilla" browser, we can assume IE or Netscape only

	if (document.all || document.layers) {
		if (navigator.appName == "Netscape") {
			isNav = true;
		} else {
			isIE = true;
		}
	}

	X_PageWidth = 780;
	
	if (isNav)
	{
		if (innerWidth > 781)
		{
			X_PageWidth = innerWidth - 20;
		}
	} else {
		if (document.body.clientWidth > 781)
		{
			X_PageWidth = document.body.clientWidth -20;
		}
	}
		


// -->
</script>
<script language="Javascript">
<!--
	




	document.write("Testing for fun<br>");

	if (isIE)
		document.write("PageWidth = " + document.body.clientWidth + "<br>");
	
	document.write("Testing around the world<br>");


	if (isNav)
		document.write("PageWidth = " + innerWidth + "<br>");

	document.write("X_PageWidth = " + X_PageWidth + "<br>");
	document.write("<br>");

// -->
</script>

hello there<br>

HWG hwg-style mailing list archives, maintained by Webmasters @ IWA