⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 windowjump.html

📁 this gives details of the network programming
💻 HTML
字号:
<HEAD>
<TITLE>Netprog JavaScript Demo - Moving Browser</TITLE>


<SCRIPT LANGUAGE=JavaScript>
<!--
// move moves the position of the window
// it's current location. 
// positive xinc will move to the right (neg to the left)
// positive yinc will move down (neg up)

function move( xinc, yinc ) {

    var jsize=20;
    window.moveBy(jsize*xinc,jsize*yinc);
}

// random jump to anywhere

function hjump() {
    xpos = Math.random() * 600
    ypos = Math.random() * 400
    window.moveTo(xpos,ypos);
}

// variable used to keep track of when the game is running
var running=0;

// start up the game 
function hyperspace_game() {
    running=1;
    hyperspace_move();
}

// stop the game
function stop_hyperspace_game() {
    running=0;
}

// make a single game move by moving the image to a random
// location and then setting up to call this routine again
// after some delay. The delay before the next call is 
// based on the value of the speed field (the user can change).
function hyperspace_move() {
    var delay = document.frm.speed.value;
    if (delay < 500) {
        document.frm.speed.value = 500;
    }
    if (running == 1) {
        hjump();
        setTimeout("hyperspace_move()",delay);
    }
}
// -->
</SCRIPT>
</HEAD>

<BODY BGCOLOR=WHITE onUnload="restore()">

<TABLE HEIGHT=380 WIDTH=200 BORDER=2>
<TD BGCOLOR=CYAN>
<FORM Name=frm>

<CENTER>Move the browser</CENTER><BR>
<TABLE>
<TR ALIGN=CENTER>
  <TD>&nbsp</TD>
  <TD><INPUT TYPE=BUTTON Name=up  WIDTH=50 Value="Up" onClick="move(0,-1)"></TD>
  <TD>&nbsp</TD>
</TR>

<TR>
<TD><INPUT TYPE=BUTTON WIDTH=50 Name=left Value="Left" onClick="move(-1,0)"></TD>
<TD>&nbsp</TD>
<TD><INPUT TYPE=BUTTON  WIDTH=50 Name=right Value="Right" onClick="move(1,0)"></TD>
</TR>

<TR>
  <TD>&nbsp</TD>
  <TD><INPUT TYPE=BUTTON  WIDTH=50 Name=down Value="Down" onClick="move(0,1)"></TD>
  <TD>&nbsp</TD>
</TR>
</TABLE>
<P>
<CENTER>
<INPUT TYPE=BUTTON Name=jump Value="Random Jump" onClick="hjump()">
</CENTER>

<HR>
<CENTER>Play the chase game</CENTER><BR>
<CENTER>
<INPUT TYPE=BUTTON WIDTH=70 Name=chase Value="Start" onClick="hyperspace_game()">
<INPUT TYPE=BUTTON WIDTH=70 Name=chase Value="Stop" onClick="stop_hyperspace_game()">
</CENTER>
<BR>
Speed : <INPUT TYPE=TEXT SIZE=5 Name=speed><BR>
<HR>
</FORM>

</TD>
</TR></TABLE>

<SCRIPT>
// save the initial window size (so we can restore it)
savewidth =  window.innerWidth;
saveheight = window.innerHeight;

function restore() {
  // Change the window size to the original values
  window.innerWidth=savewidth;
  window.innerHeight=saveheight;
}


// Change the window size to hold the controls only
//window.innerWidth=220;
//window.innerHeight=400;
window.resizeTo(300,600);
// initialize the game speed field to 2000
document.frm.speed.value=2000;


</SCRIPT>
</BODY>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -