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

📄 source.htm

📁 JavaScript_VBScript网页编程实例
💻 HTM
📖 第 1 页 / 共 2 页
字号:
<html>
<head>

<body>
本例程源程序如下:(<a href="javascript:void(0)" onClick="self.close()">关闭窗口</a>) 
<form name="form1" >
  <textarea name="textfield" cols="80" rows="30">
  &lt;html&gt;
&lt;head&gt;
&lt;title&gt;综合实例&lt;/title&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=gb2312&quot;&gt;

&lt;script language=&quot;javascript&quot;&gt;
var browserName;
var browserVersion;
startgif=new Array(2);
var BaseURL=&quot;&quot;;
var position=40;
var initialX;
var initialY;
var initialtop;
var initialleft;

function testbrowser()
{
 string=&quot;&quot;;
 browserName=navigator.appName;
 browserVersion=parseInt(navigator.appVersion);
 mywidth=screen.width;
 myheight=screen.height;
 newwindow=window.open('', 'newwindow', 'height=150, width=300, top=150,left=200, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no,status=no');
 string+=&quot;这是一个JavaScript综合应用实例,本程序适合用IE5.0或更高版本浏览,显示分辨率为1024*768时效果最佳。&quot;+&quot;&lt;br&gt;&quot;;
 string+=&quot;您现在使用的是&quot;+browserName+&quot; &quot;+browserVersion+&quot;浏览器。&quot;+&quot;&lt;br&gt;&quot;;
 string+=&quot;您的显示分辨率为:&quot;+mywidth+&quot;*&quot;+myheight;
 newwindow.document.write(string);
 setTimeout('newwindow.close()',3000)
}

function showtime()
{
 var now=new Date();
 var timestr=&quot;&quot;;
 hour=now.getHours();
 minute=now.getMinutes();
 second=now.getSeconds();
 timestr+=((hour&lt;10)?&quot;0&quot;:&quot;&quot;)+hour;
 timestr+=((minute&lt;10)?&quot;:0&quot;:&quot;:&quot;)+minute;
 timestr+=((second&lt;10)?&quot;:0&quot;:&quot;:&quot;)+second;
 document.form1.time.value=timestr;
 setTimeout(&quot;showtime()&quot;,1000);
 }

function animate_arrow()
{
 if (position!=10)
   {
    pos_str=position+&quot;%&quot;;
    arrow.style.left=pos_str;
    position--;
    timer=setTimeout(&quot;animate_arrow()&quot;,80);
    }
  else
    clearTimeout(timer);
 }

function imageload()
{
startgif[0]=new Image();
startgif[1]=new Image();
startgif[0].src=BaseURL+&quot;start_button.gif&quot;;
startgif[1].src=BaseURL+&quot;start_button2.gif&quot;;
}

function button_down()
{
start_button.src=startgif[1].src;
panel.style.visibility=&quot;visible&quot;;
}

function shownotation(index)
{
  if (index==1)
   {
    notation.style.visibility=&quot;visible&quot;;
    notation.style.left=&quot;80px&quot;;
    notation.style.top=&quot;100px&quot;;
    notation.innerHTML=&quot;&lt;font size='2'&gt;显示本网站内容的目录树&lt;/font&gt;&quot;;
    }
  if (index==2)
   {
    notation.style.visibility=&quot;visible&quot;;
    notation.style.left=&quot;80px&quot;;
    notation.style.top=&quot;199px&quot;;
    notation.innerHTML=&quot;&lt;font size='2'&gt;最近常用的几个网页文件&lt;/font&gt;&quot;;
    }
  if (index==3)
   {
    notation.style.visibility=&quot;visible&quot;;
    notation.style.left=&quot;80px&quot;;
    notation.style.top=&quot;298px&quot;;
    notation.innerHTML=&quot;&lt;font size='2'&gt;本站相关站点&lt;/font&gt;&quot;;
    }
  if (index==4)
   {
    notation.style.visibility=&quot;visible&quot;;
    notation.style.left=&quot;80px&quot;;
    notation.style.top=&quot;397px&quot;; 
    notation.innerHTML=&quot;&lt;font size='2'&gt;给网页作者发email&lt;/font&gt;&quot;;
    }
}

function hidenotation()
{
 notation.style.visibility=&quot;hidden&quot;;
 }

function selectbg(evt)
{
 initialX=evt.x;
 initialY=evt.y;
 initialleft=parseInt(explorer.style.left);
 initialtop=parseInt(explorer.style.top);
 start_button.src=startgif[0].src;
 var inPanel=(initialX&lt;190 &amp;&amp; initialY&gt;240)
 if (!inPanel)
   panel.style.visibility=&quot;hidden&quot;;
 if (evt.button==2 &amp;&amp; evt.x&gt;=70 &amp;&amp; evt.x&lt;=850 &amp;&amp; evt.y&lt;=400)
   { 
    bkground.style.left=evt.x;
    bkground.style.top=evt.y;
    bkground.style.visibility=&quot;visible&quot;;
   }
 return false;
 }

function changebg()
{
 var base=&quot;./background/&quot;;
 if (bg_form.bg_select.value==&quot;none&quot;)
    document.body.background=&quot;&quot;;
 else
    document.body.background=base+bg_form.bg_select.value;
 bkground.style.visibility=&quot;hidden&quot;;
 }

function showdetail(index)
{
 switch (index)
  {
   case 1:
     detail.innerHTML='&lt;font size=&quot;3&quot; color=&quot;#CC6666&quot;&gt; 介绍Script语言的基本知识,包括其产生,特点和作用,本章还介绍了Script的基本语法、函数和对象。&lt;/font&gt;';break;
   case 2:
     detail.innerHTML='&lt;font size=&quot;3&quot; color=&quot;#CC6666&quot;&gt;本章给出了5个基础实例,让初学者对Script语言的特性及应用产生一定的了解。&lt;/font&gt;'; break;
   case 3:
     detail.innerHTML='&lt;font size=&quot;3&quot; color=&quot;#CC6666&quot;&gt;在已经掌握了基础知识的基础上,本章给出了几个更进一步的实例,通过这些实例可以开阔读者眼界,以便熟练掌握这门语言。&lt;/font&gt;'; break;
   case 4:
      detail.innerHTML='&lt;font size=&quot;3&quot; color=&quot;#CC6666&quot;&gt;这一章给出的是一个综合实例,它综合应用了前面所讲的知识,并有进一步的提高,对读者在建立自己的网页时有一定的参考价值。&lt;/font&gt;'; break;   
   }         
 }

function explore(index)
{
 document.images[&quot;close_img&quot;].src=&quot;panel/close_1.gif&quot;;
 detail.innerHTML=&quot;&quot;;
 panel.style.visibility=&quot;hidden&quot;;
 if (index==1)
   {
    explorer.style.top=&quot;100px&quot;;
    explorer.style.left=&quot;200px&quot;;
    explorer.style.visibility=&quot;visible&quot;;
    document.images[&quot;ex_img&quot;].src=&quot;panel/mycomputer.gif&quot;;
    ex_title.innerHTML=&quot;&lt;font size='2' color='#000000'&gt;我的电脑&lt;/font&gt;&quot;;
    content.innerHTML='&lt;body bgcolor=&quot;#FFFFFF&quot; link=&quot;#3333ff&quot;&gt;&lt;p&gt;&lt;font size=&quot;3&quot;&gt;本网站包括以下内容: &lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;chapt.htm&quot; style=&quot;text-decoration:none&quot; onMouseover=&quot;showdetail(1)&quot;&gt;&lt;font size=&quot;3&quot; color=&quot;#3333cc&quot;&gt;&lt;i&gt;第一章 基础知识&lt;/i&gt;&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;chapt.htm&quot; style=&quot;text-decoration:none&quot; onMouseover=&quot;showdetail(2)&quot;&gt;&lt;font size=&quot;3&quot; color=&quot;#3333cc&quot;&gt;&lt;i&gt;第二章 基础篇&lt;/i&gt;&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;chapt.htm&quot; style=&quot;text-decoration:none&quot; onMouseover=&quot;showdetail(3)&quot;&gt;&lt;font size=&quot;3&quot; color=&quot;#3333cc&quot;&gt;&lt;i&gt;第三章 提高篇&lt;/i&gt;&lt;/font&gt;&lt;/a&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;chapt.htm&quot; style=&quot;text-decoration:none&quot; onMouseover=&quot;showdetail(4)&quot;&gt;&lt;font size=&quot;3&quot; color=&quot;#3333cc&quot;&gt;&lt;i&gt;第四章 综合篇&lt;/i&gt;&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;'
    }
 if (index==2)
   {
    explorer.style.top=&quot;100px&quot;;
    explorer.style.left=&quot;200px&quot;;
    explorer.style.visibility=&quot;visible&quot;;
    document.images[&quot;ex_img&quot;].src=&quot;panel/mydocument.gif&quot;;
    ex_title.innerHTML=&quot;&lt;font size='2' color='#000000'&gt;我的文档&lt;/font&gt;&quot;;
    content.innerHTML=&quot;&lt;p&gt;&lt;font size='3'&gt;最近经常访问以下站点:&lt;/font&gt;&lt;/p&gt;&quot;;
    }
 if (index==3)
   {
    explorer.style.top=&quot;100px&quot;;
    explorer.style.left=&quot;200px&quot;;
    explorer.style.visibility=&quot;visible&quot;;
    document.images[&quot;ex_img&quot;].src=&quot;panel/link.gif&quot;;
    ex_title.innerHTML=&quot;&lt;font size='2' color='#000000'&gt;友情链接&lt;/font&gt;&quot;;
    content.innerHTML=&quot;&lt;p&gt;&lt;font size='3'&gt;欢迎访问下列站点:&lt;/font&gt;&lt;/p&gt;&quot;;
    }
 }

function winmove(evt)
{
 deltax=evt.x-initialX;
 deltay=evt.y-initialY;
 explorer.style.left=deltax+initialleft;
 explorer.style.top=deltay+initialtop;
 }
&lt;/script&gt;

⌨️ 快捷键说明

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