Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript onload and IE4

Status
Not open for further replies.

timjwild

Programmer
Oct 13, 2000
10
0
0
GB
I have written the following page and posted it to It works as planned in NN and IE5 but not IE4. Is there some obscure reason why IE4 doesn't like my onload event?.
Code:
<html>
<head>
<title>test3</title>
<script language=&quot;javascript&quot;>
var temp;
function test()
{
  if (navigator.appName == &quot;Microsoft Internet Explorer&quot;)
   {
      document.tim.wild.value=&quot;&quot;
      document.tim.wild.focus();
   }
  if (navigator.appName == &quot;Netscape&quot; || navigator.appName == &quot;netscape&quot;)
   {
      document.tim.wild.value=&quot;&quot;
      document.tim.wild.focus();
   }
}
</script>
</head>
<body onload=&quot;javascript:test()&quot;>
14:22<br><br><br><br>
<form name=&quot;tim&quot;>
<input name=&quot;wild&quot; size=&quot;10&quot; maxlength=&quot;10&quot; value=&quot;please wait&quot;>
</form>
<br>
<a href=&quot;test4.html&quot;>go forward</a>
<br><br>
This page displays 'please wait' in the UserID box until the page is fully loaded.  It then clears the box and gives it focus enabling the user to type their ID No. in directly.  To test, a blank page has been set up to navigate forward to and back from demonstrating that the field clears each time.
<br><br>
</body>
</html>
[sig][/sig]
 
Sorry, I don't have IE4, so I can't check your code, but I can make a suggestion. To test for IE, don't use a literal string. Check for the browser's capabilites instead. The usual way to do this is:

if (document.all)
alert('this is IE')

if (document.layers)
alert ('this is Netscape 4')

If you want a more extensive browser checking routine, you can use everest.js, which I believe is available on ZDNET.com


[sig]<p>nick bulka<br><a href=mailto: > </a><br>[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top