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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

onkeyup in Netscape 4.7

Status
Not open for further replies.

rogerluo

Programmer
Aug 13, 2001
21
0
0
GB
Hello All,

here is my code:

<html>
<head>
<STYLE TYPE=&quot;text/css&quot;>
<!--
#text {position: absolute;
top: 100px;
left: 250;
width:169;
padding: 2px;
}
-->
</STYLE>
<script language=javascript>
function testing(number)
{
if(document.all)
{
var Staked = 12;

document.all.text.innerHTML = number*Staked;
}

else if(document.layers)
{
var Staked = document.frmMain.stake.value;

var id = 'text';
var x = document.layers[id];
var text2;


text2 = '<td class=&quot;a-10-dg-b-l-back&quot;>'+ number* Staked+'</td>';
x.document.open();
x.document.write(text2);
x.document.close();

}

}


function resizeBugfix()
{
if(document.layers)
{

var loadWidth
var loadHeight
loadWidth = 376;
loadHeight = 380;
innerWidth=loadWidth;
innerHeight= loadHeight;
}

else if(document.all)
{
window.resizeTo(376,500);

}
}

</script>

</head>
<META http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-16&quot;>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>

<body onload=&quot;resizeBugfix();&quot; >
<form name=&quot;frmMain&quot; action=&quot;default.asp&quot;method=&quot;POST&quot; >
<div>

<center>

<table Width=&quot;&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;>

<tr>
<td colspan=&quot;4&quot; class=&quot;a-9-w-b-c-dg&quot;>Document Testing</td>
</tr>
<tr>
<td class=&quot;a-10-w-b-r-lg&quot; height=&quot;20&quot;>Number</td>
<td width=&quot;1&quot;></td>
<td>
<input type=&quot;textbox&quot; class=&quot;Stake&quot; size =&quot;6&quot; maxlength=&quot;7&quot; name=&quot;stake&quot; onkeyup='testing(8);'

></input></td>

<td width =&quot;169&quot; ><div class=&quot;a-10-dg-b-l-back&quot; ID=&quot;text&quot;>total result is:</div></td>

</tr>
</table>
</form>
</center>
</div>
</body>

really don't know why if you load the page at first time, the onkeyup =&quot;testing()&quot; seems doesn't work; only when you reload the page, it works fine. why???

thanks a lot
</html>
 
Hi,

If you redo the resize script so its like the one in the other post that I suggested, everything works fine in netscape 4.7, hence i believe it is this which is causing u the error.

Page should be is:

<html>
<head>
<STYLE TYPE=&quot;text/css&quot;>
<!--
#text {position: absolute;
top: 100px;
left: 250;
width:169;
padding: 2px;
}
-->
</STYLE>
<script language=javascript>
function testing(number)
{
if(document.all)
{
var Staked = 12;

document.all.text.innerHTML = number*Staked;
}

else if(document.layers)
{
var Staked = document.frmMain.stake.value;

var id = 'text';
var x = document.layers[id];
var text2;


text2 = '<td class=&quot;a-10-dg-b-l-back&quot;>'+ number* Staked+'</td>';
x.document.open();
x.document.write(text2);
x.document.close();

}

}




function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName==&quot;Netscape&quot;)&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->
</script>

</script>

</head>
<META http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-16&quot;>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>

<body onload=&quot;MM_reloadPage(init);&quot; >
<form name=&quot;frmMain&quot; action=&quot;default.asp&quot;method=&quot;POST&quot; >
<div>

<center>

<table Width=&quot;&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;>

<tr>
<td colspan=&quot;4&quot; class=&quot;a-9-w-b-c-dg&quot;>Document Testing</td>
</tr>
<tr>
<td class=&quot;a-10-w-b-r-lg&quot; height=&quot;20&quot;>Number</td>
<td width=&quot;1&quot;></td>
<td>
<input type=&quot;textbox&quot; class=&quot;Stake&quot; size =&quot;6&quot; maxlength=&quot;7&quot; name=&quot;stake&quot;

onkeyup='testing(8);'

></input></td>

<td width =&quot;169&quot; ><div class=&quot;a-10-dg-b-l-back&quot; ID=&quot;text&quot;>total result is:</div></td>

</tr>
</table>
</form>
</center>
</div>
</body>


</html>

Cheers

James
 
Hi Jame,

Thank you very much. however, have you try define a value to innerHeight or innerWidth? when i did it (innerHeight = 500, or innerWidth = 350), it doesn't work again. any idea?

thank,

 
Hi,

There is an error in the script above, in the <body> tag, please remove the reference to &quot;onload&quot;.

To be honest, the easiet way to make it a certain size is to open the window at the size you original want using the window.open command

If i find a way tonight I will post it back up here

James
 
Code:
resizeTo(
Code:
x
Code:
,
Code:
 y
Code:
);
bluebrain.gif
blueuniment.gif
 
Hi,

I thought of that too, but you would need someway of stopping it resizing over and over again.

James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top