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!

JS Error IE7

Status
Not open for further replies.

rich360

Programmer
Nov 3, 2008
3
This will throw an error in IE7 but it works without errors in Mozilla Firefox, it also worked in IE6.
Any help would be greatly appreciated.

Code:
Error: Line 3: 'windowToAdust.screen' is null or not an object.

Error2:Line 29: Object doesn't support this property or method. 

<script type="text/javascript">
<!--
var windowToAdjust = ( window.external&&window.external.menuArguments ) ? window.external.menuArguments.parent : window;
function resizeWin(w,h){
	if( typeof( w ) != 'number' ) {
		w = parseInt( w ); h = parseInt( h );
		if( isNaN( w ) || isNaN( h ) || w < 100 || h < 100 ) {
			window.alert( 'Please input numerical values greater than 100 for both height and width and try again.' );
			return;
		}
	}
	windowToAdjust.moveTo(-4,-4);
	windowToAdjust.resizeTo(
		( w + 8 ) // when maximised, a window is 8px wider than the screen
		-
		( windowToAdjust.screen.width - windowToAdjust.screen.availWidth ) //allow for taskbar
		-
		( document.layers ? window.outerWidth - window.innerWidth : 0 ) //NS4 resizes the innerWidth, not outerWidth
		,
		( h + 8 ) // when maximised, a window is 8px taller than the screen
		-
		( windowToAdjust.screen.height - windowToAdjust.screen.availHeight ) //allow for taskbar
		-
		( document.layers ? window.outerHeight - window.innerHeight : 0 ) //NS4 resizes the innerHeight, not outerHeight
	);
	if( window.external && window.external.menuArguments ) { window.close(); }
}

function focusNorm() { if( window.document.forms[0]['N'+windowToAdjust.screen.width+'] ) { window.document.forms[0]['N'+windowToAdjust.screen.width+'].focus(); } }

function setZoom(oSelect) {
	if( oSelect.selectedIndex ) {
		if( windowToAdjust.document.body ) {
			if( windowToAdjust.document.body.style ) {
				if( parseInt( oSelect.options[oSelect.selectedIndex].value ) > 100 ) {
					if( !window.confirm( 'All \'drop-down\' select inputs on the page you are adjusting will no longer operate correctly. Resize anyway?' ) ) { oSelect.options[0].selected = true; return; }
				}
				windowToAdjust.document.body.style.zoom = oSelect.options[oSelect.selectedIndex].value + '%';
				if( window.external && window.external.menuArguments ) { window.close(); }
			}
		}
	}
}

		//--></script>
		<script type="text/javascript">
function formReset()
{
document.getElementById("myForm").reset()
}
</script>

Thanks, Richard
 
Error: Line 3: 'windowToAdust.screen' is null or not an object.

Perhaps you have a typo somewhere in your code, as it should be 'windowToAd[!]j[/!]ust', not 'windowToAdust'?

A few other things that stand out:

- You are never calling the function 'resizeWin'. Is it really needed? If it is, consider a nicer way of achieving the same goal without all that browser detection bloat, if possible.

- You are setting the 'zoom' style - which AFAIK doesn't work outside of IE (or certainly not in Fx2, anyway).

If you still can't resolve the error, post a URL to the page in question.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
I second the typo idea, but that would fail for all browsers. Do you have the same configuration in all of them (show javascript errors, debugging).

Cheers,
Dian
 
I initially thought much the same, then realised that there's so much browser detection going on in the code we can see, and there's probably a lot of code we cannot see, so the likelihood is great that the typo exists in IE7 code that we haven't been given :)



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
I didn't see the browser detection thinguie, just searched for "windowToAdust" :)

Cheers,
Dian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top