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 Appended

Status
Not open for further replies.

rich360

Programmer
Nov 3, 2008
3
I've enclosed the complete program, perhaps it will help.
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.

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
body {
background-color:#37789D;
font-family:Arial, Helvetica, sans-serif;
font-size:12px;
color:#ffffff;
font-weight:bold;
margin-top:225px;}
.p{margin-left:300px;}
.space {padding: 0px 0px 0px 15px;}
</style>
<title>Resizer</title>

<!--
IE Error1: Line 3: 'windowToAdust.screen' is null or not an object.

IE 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>

</head>
<body onLoad="if( window.focusNorm ) { focusNorm(); }">
<form id="myForm" method="get" action="resizer.html" onSubmit="return false;">
<h1 align="center">
Select Screen Dimensions<br>
<input type="button" onClick="resizeWin(640,480);" name="N640"
value="640 x 480"><input type="button" onClick="resizeWin(800,600);" name="N800"
value="800 x 600"><input type="button" onClick="resizeWin(1024,768);" name="N1024"
value="1024 x 768"><input type="button" onClick="resizeWin(1146,978);" name="N1152"
value="1152 x 864"><input type="button" onClick="resizeWin(1280,1024);" name="N1280"
value="1280 x 1024"><input type="button" onClick="resizeWin(1600,1200);" name="N1600"
value="1600 x 1200"> &nbsp; &nbsp; <input type="text" name="nW" size="4" value=""
maxlength="4"><input type="text" name="nH" size="4" value=""
maxlength="4"> <input type="button" onClick="resizeWin(window.document.forms[0].nW.value,window.document.forms[0].nH.value);" class="space" value="Custom size">
<input type="button" onClick="formReset()" value="Reset">
</h1>
<p class="p">You cannot resize to larger than your monitor size.<br>
To work correctly the resizer must open by itself with no open tabs.<br>
Example: Open the &quot;Resizer&quot; and add it to your favorites or bookmarks<br>
then open the page you want to re-size (without a new tab) and use your<br> backspace key
to view the resizer page and select a screen dimension.</p>
<h3 align="center">
Cancel:<br>
<input type="button" onClick="window.close();" value="Close Window">
</h3>
</form>
</body>
</html>
 
Hi

rich360 said:
JS Error IE7 [red]Appended[/red]
What mean by "appended" ? What changed since your previous thread216-1536998 ?

( And please continue using [tt][ignore]
Code:
[/ignore][/tt] and [tt][ignore]
[/ignore][/tt] tags around your code. )

Feherke.
 
You have a syntax error with an extra quote:

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

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
P.S. Installing the free MS script debugger showed this to me immediately. I can highly recommend getting this - or any debugger - as it helps you to find these things for yourself.

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top