[thelist] Weird Javascript Problem
R.Livsey
R.Livsey at cache-22.co.uk
Sat Mar 2 14:08:01 CST 2002
Hi, appologies if this is a known problem, or just me being stupid as Im
not big on Javascript. Should learn the DOM better one of these days!
In IE (havent tested with anything else yet) I get an error (Object
Expected) for the following code :
<script language="JavaScript1.2">
//if browser supports window.innerWidth
if (window.innerWidth)
document.write(window.innerWidth)
//else if browser supports document.all (IE 4+)
else if (document.all)
document.write(document.body.clientWidth)
</script>
Which really confused me as there isnt much there to go wrong!
However, If I put a document.write("some text") before everything like
so :
<script language="JavaScript1.2">
document.write("some text")
//if browser supports window.innerWidth
if (window.innerWidth)
document.write(window.innerWidth)
//else if browser supports document.all (IE 4+)
else if (document.all)
document.write(document.body.clientWidth)
</script>
Then all works fine!
Whats going on here?
Im working on some javascript to gather browser details to be submitted
to a database.
Cheers.
--
R.Livsey
[ PHP | Perl | mySQL | Java ]
w : cache-22.co.uk
e : R.Livsey at cache-22.co.uk
m : +447764 685 701
i : 37530949
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.325 / Virus Database: 182 - Release Date: 19/02/2002
More information about the thelist
mailing list