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

📄 followwinpic.htm

📁 简单的讲解语言,非常实用,使你在短期内就能熟练掌握其变成技巧
💻 HTM
字号:
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../homepage.css">
<script language=javascript>
<!-- Begin
function setVariables() {
imgwidth=50; 
imgheight=50;  
if (navigator.appName == "Netscape") {
		horz=".left";
		vert=".top";
		docStyle="document.";
		styleDoc="";
		innerW="window.innerWidth";
		innerH="window.innerHeight";
		offsetX="window.pageXOffset";
		offsetY="window.pageYOffset";
	}
	else {
		horz=".pixelLeft";
		vert=".pixelTop";
		docStyle="";
		styleDoc=".style";
		innerW="document.body.clientWidth";
		innerH="document.body.clientHeight";
		offsetX="document.body.scrollLeft";
		offsetY="document.body.scrollTop";
	}
}
function checkLocation() {
	objectXY="branding";
	var availableX=eval(innerW);
	var availableY=eval(innerH);
	var currentX=eval(offsetX);
	var currentY=eval(offsetY);
	x=availableX-(imgwidth+30)+currentX;
	y=availableY-(imgheight+20)+currentY;
	evalMove();
	setTimeout("checkLocation()",10);
}
function evalMove() {
	eval(docStyle + objectXY + styleDoc + horz + "=" + x);
	eval(docStyle + objectXY + styleDoc + vert + "=" + y);
}
// End -->
</script>
</head>

<body bgcolor="#FFFFFF" onload="setVariables(); checkLocation();">
<script language="Javascript" src="/pub/js/head.js"></script>
<table width="760" height="20" border=0 cellspacing="0" cellpadding="0" align="center" >
  <tr bgcolor="CFDFFF"> 
    <td height=20 class="p1" align="left"><img src="/pc/img/blank.gif" width="12" height="8"><font color="#000000"><font color="#FF9966">当前位置</font>:<a href="/default.htm" class="under">洪恩在线</a> 
      -&gt; <a href="/pc/index.htm" class="under">电脑乐园</a> -&gt; JavaScript</font></td>
  </tr>
</table> 
<table width="760" border=0 cellspacing="0" cellpadding="0" align="center">
  <tr> 
    <td width="207" valign="top"><img src="img/bule.gif" width="207" height="13"></td>
    <td bgcolor="A8A8AB" width="1"><img src="img/blank.gif" width="1" height="1"></td>
    <td align="right" height="22" width=530><img src="img/js.gif" width="186" height="20"></td>
    <td width="22"><img src="img/blank.gif" width="1" height="1"></td>
  </tr>
</table>
<table width="760" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr> 
    <td width="124"><img src="img/blank.gif" width="1" height="1"></td>
    <td background="img/line.gif" height="27" width=636><img src="img/blank.gif" width="1" height="1"></td>
  </tr>
</table>
<table width="760" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr> 
    <td class=p3 align="center" width=711><b>    图形随窗口移动</b></td>
    <td class="p2" width="1" bgcolor="A8A8AB"><img src="img/blank.gif" width="1" height="1"></td>
    <td class="p2" width="48">&nbsp;</td>
  </tr>
</table>
<table width="760" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr> 
    <td align="center" valign="top">&nbsp;</td>
    <td>&nbsp;</td>
    <td bgcolor="5F74BF" width="28" align="center"><img src="img/bule1.gif" width="28" height="49"></td>
    <td width="37" align="center">&nbsp;</td>
  </tr>
  <tr> 
    <td align="center" valign="top"> 
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr align="center"> 
          <td> 
            <table width="110" border="0" cellspacing="0" cellpadding="0">
              <tr bgcolor="5F74BF" align="center"> 
                <td class="p1" align="right"><b><font color="#FFFFFF">效 果 演 示</font></b><font color="#FFFFFF">:</font></td>
                <td class="p1" width="11"><img src="img/bule2.gif" width="11" height="18"></td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
    <td class=p2 align="left" > 
      <p>&nbsp;</p>
      <div id="branding" style="position:absolute; visibility:show;"> 
        <table width="10" bgcolor="#ffffff">
          <tr> 
            <td> 
              <p align="center"><a href="http://www.hongen.com/pc/index.htm">
              <img src="img/fix.gif" alt="你好,我总是在这!" border="0" ></a> 
            </td>
          </tr>
        </table>
      </div>
      <b><font color="#FF6666">拖动垂直滚动条,看看屏幕右下角的图形!</font></b></td> 
    <td bgcolor="5F74BF" width="28" align="center">&nbsp;</td>
    <td width="37" align="center">&nbsp;</td>
  </tr>
  <tr> 
    <td align="center" valign="top"> 
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td height="15">&nbsp;</td>
        </tr>
        <tr align="center"> 
          <td> 
            <table width="110" border="0" cellspacing="0" cellpadding="0">
              <tr bgcolor="5F74BF" align="center"> 
                <td class="p1" align="right"><b><font color="#FFFFFF">源代码如下</font></b><font color="#FFFFFF">:</font></td>
                <td class="p1" width="11"><img src="img/bule2.gif" width="11" height="18"></td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
    <td width="457" class="p2" valign="top"><b><br>
      <br>
      </b><span class="p1"><font color="#6633FF"> </font></span><b><br>
      </b>
      <form>
        <p><span class="p1"><font color="#6633FF">这段程序放在&lt;head&gt;与&lt;/head&gt;之间</font></span> 
          <textarea name="textarea3" onFocus="this.select()" onMouseOver="this.focus()" cols="50" rows="15" wrap="VIRTUAL" style="BACKGROUND-COLOR: #D5E9FD;" >&lt;script language=javascript&gt;
&lt;!-- Begin
function setVariables() {
imgwidth=50; 
imgheight=50;  
if (navigator.appName == &quot;Netscape&quot;) {
horz=&quot;.left&quot;;
vert=&quot;.top&quot;;
docStyle=&quot;document.&quot;;
styleDoc=&quot;&quot;;
innerW=&quot;window.innerWidth&quot;;
innerH=&quot;window.innerHeight&quot;;
offsetX=&quot;window.pageXOffset&quot;;
offsetY=&quot;window.pageYOffset&quot;;
}
else {
horz=&quot;.pixelLeft&quot;;
vert=&quot;.pixelTop&quot;;
docStyle=&quot;&quot;;
styleDoc=&quot;.style&quot;;
innerW=&quot;document.body.clientWidth&quot;;
innerH=&quot;document.body.clientHeight&quot;;
offsetX=&quot;document.body.scrollLeft&quot;;
offsetY=&quot;document.body.scrollTop&quot;;
   }
}
function checkLocation() {
objectXY=&quot;branding&quot;;
var availableX=eval(innerW);
var availableY=eval(innerH);
var currentX=eval(offsetX);
var currentY=eval(offsetY);
x=availableX-(imgwidth+30)+currentX;
y=availableY-(imgheight+20)+currentY;
evalMove();
setTimeout(&quot;checkLocation()&quot;,10);
}
function evalMove() {
eval(docStyle + objectXY + styleDoc + horz + &quot;=&quot; + x);
eval(docStyle + objectXY + styleDoc + vert + &quot;=&quot; + y);
}
// End --&gt;
&lt;/script&gt;</textarea>
        </p>
        <p><span class="p1"><font color="#6633FF">这段程序放在&lt;body ****&gt;正文中</font></span></p>
        <p>
          <textarea name="textarea" onFocus="this.select()" onMouseOver="this.focus()" cols="50" rows="2" wrap="VIRTUAL" style="BACKGROUND-COLOR: #D5E9FD;" >onload=&quot;setVariables(); checkLocation();&quot;</textarea>
        </p>
      </form>
      <b> </b></td>
    <td bgcolor="5F74BF" width="28" align="center">&nbsp;</td>
    <td width="37" align="center">&nbsp;</td>
  </tr>
  <tr>
    <td align="center" valign="bottom" height="36"> 
      <table width="238" border="0" cellspacing="0" cellpadding="0">
        <tr align="center"> 
          <td> 
            <table width="110" border="0" cellspacing="0" cellpadding="0">
              <tr bgcolor="5F74BF" align="center"> 
                <td class="p1" align="right"><b><font color="#FFFFFF">源程序讲解:</font></b></td>
                <td class="p1" width="11"><img src="img/bule2.gif" width="11" height="18"></td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
    <td width="457" class="p2" valign="top" height="36">&nbsp;</td>
    <td bgcolor="5F74BF" width="28" align="center" height="36"><img src="img/bule1.gif" width="28" height="49"></td>
    <td width="37" align="center" height="36">&nbsp;</td>
  </tr>
</table>
<table width="760" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr> 
    <td class="p2" align="right" width="693"> <br>
      <table width="650" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td>
            <table width="100%" border="1" cellspacing="1" cellpadding="1" bordercolorlight="#666666" bordercolordark="#666666" class=p2>
              <tr> 
                <td width="45%">function setVariables()<br>
                </td>
                <td width="55%">定义一个函数。</td>
              </tr>
              <tr bgcolor="CFDFFF"> 
                <td width="45%">{ imgwidth=50;<br>
                  imgheight=50; <br>
                </td>
                <td width="55%">设置两个变量的初值。</td>
              </tr>
              <tr> 
                <td width="45%">if (navigator.appName == &quot;Netscape&quot;)<br>
                  { horz=&quot;.left&quot;; <br>
                  vert=&quot;.top&quot;;<br>
                  docStyle=&quot;document.&quot;; <br>
                  styleDoc=&quot;&quot;; <br>
                  innerW=&quot;window.innerWidth&quot;;<br>
                  innerH=&quot;window.innerHeight&quot;;<br>
                  offsetX=&quot;window.pageXOffset&quot;;<br>
                  offsetY=&quot;window.pageYOffset&quot;; }<br>
                </td>
                <td width="55%">如果浏览器是Netscape,设置各变量的值。</td>
              </tr>
              <tr bgcolor="CFDFFF"> 
                <td width="45%">else { horz=&quot;.pixelLeft&quot;; <br>
                  vert=&quot;.pixelTop&quot;; <br>
                  docStyle=&quot;&quot;; <br>
                  styleDoc=&quot;.style&quot;; innerW=&quot;document.body.clientWidth&quot;; 
                  <br>
                  innerH=&quot;document.body.clientHeight&quot;;<br>
                  offsetX=&quot;document.body.scrollLeft&quot;; offsetY=&quot;document.body.scrollTop&quot;; 
                  } </td>
                <td width="55%">如果浏览器是IE,设置各变量的值。</td>
              </tr>
              <tr> 
                <td width="45%">} function checkLocation() { <br>
                </td>
                <td width="55%">定义一个函数。</td>
              </tr>
              <tr> 
                <td width="45%" bgcolor="CFDFFF">objectXY=&quot;branding&quot;;<br>
                  var availableX=eval(innerW); <br>
                  var availableY=eval(innerH);<br>
                  var currentX=eval(offsetX);<br>
                  var currentY=eval(offsetY); </td>
                <td width="55%" bgcolor="CFDFFF">声明变量,并赋值。</td>
              </tr>
              <tr> 
                <td width="45%">x=availableX-(imgwidth+30)+currentX; <br>
                  y=availableY-(imgheight+20)+currentY; <br>
                  evalMove(); </td>
                <td width="55%">设置图片的位置:离屏幕的右边为30,离屏幕下端为20。</td>
              </tr>
              <tr bgcolor="CFDFFF"> 
                <td width="45%">setTimeout(&quot;checkLocation()&quot;,10); } 
                  <br>
                </td>
                <td width="55%">每10毫秒,调用一次checkLocation()函数。</td>
              </tr>
              <tr> 
                <td width="45%">function evalMove() <br>
                  { eval(docStyle + objectXY + <br>
                  styleDoc + horz + &quot;=&quot; + x);}<br>
                  eval(docStyle + objectXY +<br>
                  styleDoc + vert + &quot;=&quot; + y); }</td>
                <td width="55%">定义evalMove函数。</td>
              </tr>
              <tr bgcolor="CFDFFF"> 
                <td width="45%">onload="setVariables(); checkLocation();"</td>
                <td width="55%">页面装载时,调用setVariables(); checkLocation()函数。</td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
      <br>
      <br>
    </td>
    <td class="p2" width="18">&nbsp;</td>
    <td class="p2" width="1" bgcolor="A8A8AB"><img src="img/blank.gif" width="1" height="1"></td>
    <td class="p2" width="48">&nbsp;</td>
  </tr>
</table>
<table width="760" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr bgcolor="5F74BF"> 
    <td>&nbsp;</td>
  </tr>
</table>
<p>&nbsp;</p>
</body>
</html>

⌨️ 快捷键说明

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