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 Variable Error 2

Status
Not open for further replies.

rich360

Programmer
Nov 3, 2008
3
I've enclosed the corrected 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.
I also tried to use ms script debugger but it has issues with Vista even when I change the compatibility,
it only works one or two times then displays a blank screen.
Any help would be greatly appreciated.
Thanks, rich360.

<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(1245,1000);" name="N1280"
value="1245 x 1000">
<input type="button" onClick="resizeWin(1600,1040);" name="N1600"
value="1600 x 1040">
&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>
 
It works fine for me in IE7 now that you've fixed your earlier typos.

Perhaps you have some sort of security add-on or plugin installed which is stopping the script from running?

Perhaps your security settings are such that no scripts are running?

Perhaps you have some internet / security suite running that is interfering with the script in IE7?

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
Still "Adust" error?

Sounds like an old version of the js caching elsewhere. I'd remove temporary internet files and cache.

Cheers,
Dian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top