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!

External js crashing ie

Status
Not open for further replies.
Mar 3, 2006
25
Whether '/weblib/lib_ajax.js' is blank, has ONLY 'var a=4;' OR is full of lots of functions, when I activate the child in IE it crashes windows. No problems in Firefox. If I leave
Code:
	win151122.document.write('<script type="text/javascript" src="/weblib/lib_ajax.js"><\/script>');
out of the parent calling window it works fine but of coarse I wouldn't have access to those functions. Can someone tell me how to make this work << OR >> just that blank windows can't call external javascript files.

Following is the parent window.

Code:
<script>
var win151122;
function closeDep() {
	if (win151122 && win151122.open	&& !win151122.closed) { win151122.close(); }
}
function showreg(type,code) {
	if (win151122 && win151122.open && !win151122.closed) {
		win151122.close();
	}
	var width=325; var height=350; var left=400; var top=175;
	win151122=window.open("about:blank","goombie",
	"width="+width+",height="+height+",left="+left+",top="+top+",screenX=0,screenY=0,"+
	"location=0,menubar=0,resizable=1,scrollbars=0,status=0,titlebar=0");
	win151122.document.open();
	win151122.document.write('<head>');
	win151122.document.write('<script type="text/javascript" src="/weblib/lib_ajax.js"><\/script>');
	win151122.document.write('</head>'+
	'<body>'+
	'<form id="form1" name="form1">test form');
	win151122.document.write('<\/form><\/BODY>');
	win151122.document.close();
	win151122.focus();
}
</SCRIPT>
<body onUnload="closeDep();">
<a href="" onclick="showreg('A','01'); return false;">A01</a>
</body>

Tusan tuk
 
I found an obscure, unrelated script source that assigned everything I want to send,including the external javascript, to a variable first and then write the variable. That appears to be the trick.

Thanx for the input.
Rois

Code:
<html>
<script>
var win151122;
function closeDep() {
	if (win151122 && win151122.open	&& !win151122.closed) { win151122.close(); }
}
function showreg(type,code) {
	if (win151122 && win151122.open && !win151122.closed) {
		win151122.close();
	}
	var width=325; var height=350; var left=400; var top=175;
	win151122=window.open("about:blank","goombie",
	"width="+width+",height="+height+",left="+left+",top="+top+",screenX=0,screenY=0,"+
	"location=0,menubar=0,resizable=1,scrollbars=0,status=0,titlebar=0");
	var content='<head>';
	content+='<script type="text/javascript" src="/weblib/lib_ajax.js"><\/script>';	
	content+='</head><body onload=""><form id="form1" name="form1">test form';
	content+='<script><\/script>'
	content+='<\/form><\/BODY>';
	win151122.document.write(content);
	win151122.document.close();
	win151122.focus();
}
</SCRIPT>
<body onUnload="closeDep();">
<a href="" onclick="showreg('A','01'); return false;">A01</a>
</body>
</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top