IE tells me there's an error on line 17, which is the onload method of the body tag. So here's the code...

<script language="javascript" type="application/javascript">
		function startUp() {
		function setFocus(){

And here's how it's called:

<body onload="startUp();">

I tested this in Safari, Firefox, IE 8, Opera, and Chrome. Works in all except IE 8.

Recommended Answers

All 6 Replies

Rather than using <body onload="startUp();"> try this in a global area of your javascript.

window.onload = startUp;

Rather than using <body onload="startUp();"> try this in a global area of your javascript.

window.onload = startUp;

thanks for the suggestion. I tried it but it still doesn't work. I'm no longer receiving an script error, but nothing happens. it does still work in firefox though.

Instead of using form name and form element name try using getElementById

If it doesn't works for you, i am expecting that onloading of the body the script is while that js function is executiing , the form was not loaded at that time.

okay, to try and resolve the issue i've altered the code and made it even simpler...

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel=stylesheet href="css/main.css" type="text/css" media="screen" />
    <title>Web site</title>
    <script language="javascript" type="application/javascript">
		function startUp(){
<body onload="startUp();">

This again works in FF but IE produces this error:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; MS-RTC EA 2; OfficeLiveConnector.1.4; OfficeLivePatch.1.3)
Timestamp: Wed, 17 Mar 2010 19:02:26 UTC

Message: Object expected
Line: 16
Char: 1
Code: 0
URI: http://server/index.php

What object is IE expecting that no other browser seems to care about?

I forgot to mention, line 16 is the <body onload="startUp();"> line.

I found the problem! The line <script language="javascript" type="application/javascript"> should be <script language="javascript"[B] type="text/javascript"[/B]> imagine that...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.