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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript Object Not Found since moved server

Status
Not open for further replies.
Jan 26, 2001
45
0
0
US
Hi I wonder if anyone might be able to help me, I have moved a site over from Windows 2000 IIS5 to Windows 2003 IIS6 and since have experienced a Javascript error on a page which worked on IIS5, can anyone shed anylight as to whether I have missed something on the server configuration.

Calendarscript.inc

Code:
var mCalname = null;
var iswinopen = 0;

function OpenCalendar(mCaller,mCalname,mTitle)
    { 
        if (iswinopen == 0)
        {
            mCalname = window.open("/e-forms/st_calendar.asp?caller="+mCaller+"&title="+mTitle,mCalname,"titlebar=no,width=255,height=270,left=200,top=100,resizable=no,toolbar=no,status=no,menubar=no,directories=no,scrollbars=no,copyhistory=no,location=no"); 
            iswinopen = 1;
        }

        
    }
Basic page

Code:
<html>
<head>
<script type="text/javascript" src="calendarscript.inc"></script>
</head>
<body>
<form name="page_form">
<input type="text" name="bookingdate" size="13" style="width:100" readonly value="">
<input type="button" name="bookingdatebutton" value="Calendar" onClick="javascript: OpenCalendar('page_form.bookingdate','bookingdatecalendar','Booking Date');">
</form>
</body>
</html>

Please can anyone help?

Andrew Westgarth
Web Developer
 
WHAT ERROR DO U GET?

---------------------------
WORD OR VOTE TO THE WISE IS ENUFF...;)
 
I'm guessing from the title of the thread that the error would be "Object Not Found"?


Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Maybe this will be fixed if you remove the (erroneous) "javascript:" string from the beginning of your onclick:
Code:
... onClick="[COLOR=red]javascript:[/color] OpenCale...
If not... then you need to identify at what point of the JS it's erroring. Is it even calling the function?! I use a lot of alert() boxes to debug this kind of thing.

Cheers,
Jeff
 
sorry yes it was object not found, now it's object expected.

Andrew Westgarth
Web Developer
 

sorry yes it was object not found, now it's object expected.
Hmm... so what did you alter to change the error message? You're not really providing us with a wealth of information to go on here.

Jeff

 
My apologies for lack of information, I have been debugging a few things.

To get the new error I removed the javascript: call from the onclick event. I have also added multiple alerts to the javascript file and have found that the error lies in the mCalName assignment.

Code:
var mCalname = null;
var iswinopen = 0;

alert("before function");

function OpenCalendar(mCaller,mCalname,mTitle)
	{ 
	alert("inside open calendar");

		if (iswinopen == 0)
		{
			alert("inside if");			
			 mCalname = window.open("/e-forms/st_calendar.asp?caller="+mCaller+"&title="+mTitle,mCalname"titlebar=no,width=255,height=270,left=200,top=100,resizable=no,toolbar=no,status=no,menubar=no,directories=no,scrollbars=no,copyhistory=no,location=no"); 
			alert ("window opened");
			 iswinopen = 1;
			alert("end of window call");
			}
	//alert("after the if");
		
	}

html file
Code:
<html>
<head>
<script src="calendarscript.js"></script>
</head>
<body>
<form name="page_form" id="page_form">
<input type="text" name="bookingdate" size="13" style="width:100" readonly value="">
<input type="button" name="bookingdatebutton" value="Calendar" onClick="OpenCalendar('page_form.bookingdate','bookingdatecalendar','Booking Date');"
</form>
</body>
</html>

I am starting to think it might be down to permissions for the asp page the calendar is referencing however I believe all of the permissions are the same as on the IIS 5 server so should cause no errors. Can anyone see any script errors with this call and the function. All of the alerts are displaying and the call is being made, it would appear there can only be problems with the variables/parameters being fed in.

Any help is appreciated.

Thanks to those who have already helped.



Andrew Westgarth
Web Developer
 
*grr* why the cross-post. I'll repost here, as I expect the other thread to be deleted (see what confusion it causes?!).

What error are you getting? I can't see anyting too obvious. Have you tried running the page in Firefox to see if the JavaScript console shows anything meaningful?

The only thing I would change would be to remove the "javascript: " from the onclick attribute - it is not really needed.

If you really want, you can also change the last parameter of your window.open call to make it a lot smaller with no loss of functionality: "width=255,height=270,left=200,top=100" is all you really need to put.

You should also change "width:100" to "width:100px" as IE lets people use sloppy coding standards - not a good tihng in my opinion.

One thing you might try - check to see if the ".inc" files are served up with a different MIME type from the previous server - that could potentially stop the JavaScript from being included.

Hope this helps,
Dan


[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Just a thought... test the permissions by requesting the URL directly. See if th is URL works... if it does, your permissions are set correctly and we move on.
Code:
<a href="/e-forms/st_calendar.asp?caller=page_form.bookingdate&title=Booking Date">Test 1</a>
If that code errors (not as the result of permissions), then maybe you need to change the final parameter in the URL to remove the space:
Code:
<a href="/e-forms/st_calendar.asp?caller=page_form.bookingdate&title=[COLOR=red]BookingDate[/color]">Test 1</a>
It's worth a check :)

I see a missing comma in the code you just posted (but not in your original code) hilighted in red below:
Code:
mCalname = window.open("/e-forms/st_calendar.asp?caller="+mCaller+"&title="+mTitle,mCalname[COLOR=red],[/color]"titlebar=no...
Regarding that line... you re-use the mCalname variable. Might I suggest you change the line so that you don't reuse it (just for this test):
Code:
mCalname[COLOR=red]Handle[/color] = window.open("/e-forms/st_calendar.asp?caller="+mCaller+"&title="+mTitle,mCalname,"titlebar=no...
Let us know how the results... hopefully you'll me a little closer to a solution after trying the above.

Cheers,
Jeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top