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!

IE 6 window.open scripting error - help!

Status
Not open for further replies.

kdelacruz

Technical User
Oct 7, 2002
25
0
0
ES
Hello,
I have a client of a client who is using IE6 (with the latest update applied) on Windows 2000 Pro (latest update also) trying to view pages on a web site I created, and is having problems with javascript that opens a new window to load a page. He gets a scripting error: no new window opens up, and a scripting error yellow triangle appears at the bottom left of the screen. The error is "Object does not support this property or method".
The line number of the error (line 148, char 4) seems to be the line I'm calling the function that opens the new window.

His security setting in IE is medium. Also, he is able to open up new windows by right-clicking and choosing Open In New Window.

I have tried this same page on other computers seemingly set up the same, and it works fine. Does anyone have any ideas on what this could be?

You can test it out at Click on one of the items like "Company Overview" (that's the shortest one). It should open playdemo.htm in a new window and play a flash presentation.

Here's my function code
Code:
function openNewWin(mydesc, myfile) {

	var mypos = mydesc.indexOf(&quot;<&quot;);

	if (mypos > 0)
	{
		var mynewdesc = mydesc.substring(0,mypos);
	}
	else
	{
		var mynewdesc = mydesc;
	}

	if (myfile.indexOf(&quot;playall_&quot;) == 0)
	{
		var myfilelength = myfile.length
		var mycategory = myfile.substring(8,myfile.length);
		document.frmDemo.democategory.value = mycategory;
		myfile = &quot;playall&quot;;
	}
	else
	{
		document.frmDemo.democategory.value = &quot;&quot;;
	}
	document.frmDemo.demodesc.value = mynewdesc;
	document.frmDemo.demofilename.value = myfile;

	//get screen resolution and set res to hi or lo
	//set to hi by default; hi is > 800x600
	childclicked = 1;
	YourRes = &quot;hi&quot;;
	mypage=&quot;training/playdemo.htm&quot;;

	if (screen.width < 1024 && screen.height < 768)
	{
		YourRes = &quot;lo&quot;;
	}

	// Place the window
	var NewWinX=15;
	var NewWinY=15;

	if (YourRes==&quot;lo&quot;)
	{
		DemoWin =window.open(mypage,'TheNewpop','fullscreen=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no');
	}
	else
	{
		DemoWin =window.open(mypage,'TheNewpop','fullscreen=no, height=700, width=850, toolbar=no,titlebar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes');
		DemoWin.moveTo(NewWinX,NewWinY);
	}
}

And here's how I call the function from the original window:
Code:
<span class=linklike onClick='openNewWin(&quot;FIN Training Presentations: Fixed Income&quot;, &quot;playall_Fixed Income&quot;);'>Fixed Income</span>


I appreciate any help!

Thanks,
-Kathy
 

Kathy,

The only errors I get are when trying to reference the 3 form objects &quot;demodesc&quot;, &quot;demofilename&quot;, and &quot;democategory&quot;. Obviously for my test purposes, I removed these (you didn't include the form code), and all worked.

So I'm wondering if you have all those form objects on your original page? If so, are the names correct (remember Javascript is case-sensitive).

If this fails, can you post the complete HTML?

Hope this helps!

Dan
 
Hi, Dan
I do have these form objects in my page; here's the html:
Code:
<form Name='frmDemo' id='frmDemo'>
<input id='demofilename' name='demofilename' type='hidden' value=''>
<input id='demodesc' name='demodesc' type='hidden' value=''>
<input id='democategory' name='democategory' type='hidden' value=''>
<ul margin=20>
<li><span class=linklike onClick='openNewWin(&quot;FIN Training Presentations: Company Overview&quot;, &quot;playall_Company Overview&quot;);'>Company Overview</span> <i>(time: 1:15)</i>
<li><span class=linklike onClick='openNewWin(&quot;FIN Training Presentations: Accounts & Interested Parties&quot;, &quot;playall_Accounts and Interested Parties&quot;);'>Accounts & Interested Parties</span> <i>(time: 4:00)</i>
.
. (more spans here)
.
</form>

I have them in form fields so that they're available from the javascript in the file playdemo.htm that plays the flash files.


I appreciate your help .. let me know if you need more info

-Kathy
 

Kathy,

It still works for me, all the time.

The only difference between the code I'm testing, and the code you posted, is that I filled in all the missing head, body, script tags, etc:

Code:
<html>
<head>
<script language=&quot;javascript&quot;>
<!--

// I placed your JS script in here

//-->
</script>

</head>
<body>

<!-- I placed your html form code in here -->

</body>
</html>

Apart from that, everything remained unchanged.

If you place your code in the template I've just given, does it still work? If so, I suspect it's either an error elsewhere in your code (you'd need to post the whole thing, or a URL to the whole thing), or an error with the setup of the browser.

Hope this helps!

Dan
 
Thanks, Dan
You were right -- it was a problem with the person's browser.
After you and some other people tested it and it worked, I became a little suspicious ...
Finally he deleted his Temporary Internet Files and it worked fine after that.
I feel silly not having him try that first -- I just assumed there was something wrong with my code!

Thanks for all your help -- I REALLY appreciate it!!

-Kathy

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top