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

📄 综合实例.htm

📁 JavaScript_VBScript网页编程实例
💻 HTM
📖 第 1 页 / 共 2 页
字号:
<html>
<head>
<title>综合实例</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<script language="javascript">
var browserName;
var browserVersion;
startgif=new Array(2);
var BaseURL="";
var position=40;
var initialX;
var initialY;
var initialtop;
var initialleft;

function testbrowser()
{
 string="";
 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+="这是一个JavaScript综合应用实例,本程序适合用IE5.0或更高版本浏览,显示分辨率为1024*768时效果最佳。"+"<br>";
 //string+="您现在使用的是"+browserName+" "+browserVersion+"浏览器。"+"<br>";
 string+="您的显示分辨率为:"+mywidth+"*"+myheight;
 newwindow.document.write(string);
 setTimeout('newwindow.close()',1000)
}

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

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

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

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

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

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

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<190 && initialY>240)
 if (!inPanel)
   panel.style.visibility="hidden";
 if (evt.button==2 && evt.x>=70 && evt.x<=850 && evt.y<=400)
   { 
    bkground.style.left=evt.x;
    bkground.style.top=evt.y;
    bkground.style.visibility="visible";
   }
 return false;
 }

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

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

function explore(index)
{
 document.images["close_img"].src="panel/close_1.gif";
 detail.innerHTML="";
 panel.style.visibility="hidden";
 if (index==1)
   {
    explorer.style.top="100px";
    explorer.style.left="200px";
    explorer.style.visibility="visible";
    document.images["ex_img"].src="panel/mycomputer.gif";
    ex_title.innerHTML="<font size='2' color='#000000'>我的电脑</font>";
    content.innerHTML='<body bgcolor="#FFFFFF" link="#3333ff"><p><font size="3">本网站包括以下内容: </font></p><p><a href="chapt.htm" style="text-decoration:none" onMouseover="showdetail(1)"><font size="3" color="#3333cc"><i>第一章 基础知识</i></font></a></p><p><a href="chapt.htm" style="text-decoration:none" onMouseover="showdetail(2)"><font size="3" color="#3333cc"><i>第二章 基础篇</i></font></a></p><p><a href="chapt.htm" style="text-decoration:none" onMouseover="showdetail(3)"><font size="3" color="#3333cc"><i>第三章 提高篇</i></font></a</p><p><a href="chapt.htm" style="text-decoration:none" onMouseover="showdetail(4)"><font size="3" color="#3333cc"><i>第四章 综合篇</i></font></a></p></body>'
    }
 if (index==2)
   {
    explorer.style.top="100px";
    explorer.style.left="200px";
    explorer.style.visibility="visible";
    document.images["ex_img"].src="panel/mydocument.gif";
    ex_title.innerHTML="<font size='2' color='#000000'>我的文档</font>";
    content.innerHTML="<p><font size='3'>最近经常访问以下站点:</font></p>";
    }
 if (index==3)
   {
    explorer.style.top="100px";
    explorer.style.left="200px";
    explorer.style.visibility="visible";
    document.images["ex_img"].src="panel/link.gif";
    ex_title.innerHTML="<font size='2' color='#000000'>友情链接</font>";
    content.innerHTML="<p><font size='3'>欢迎访问下列站点:</font></p>";
    }
 if (index==4)
   {
    explorer.style.top="100px";
    explorer.style.left="200px";
    explorer.style.visibility="visible";
    document.images["ex_img"].src="panel/help.gif";
    ex_title.innerHTML="<font size='2' color='#000000'>本站介绍</font>";
    content.innerHTML='<font size="3">本网页是<a href="www.tup.tsinghua.edu.cn" style="text-decoration:none"><font color="#3333CC"><i> 清华大学出版社 </i></font></a>出版的<i>"JavaScript/VBScript网页编程实例解析"</i>一书的示范程序,用于向大家介绍一个综合的Script语言应用实例,相信会对读者有一定的参考价值,同时欢迎大家对本程序提出批评建议,读者可以与<a href="mailto:author@tup.tsinghua.edu.cn" style="text-decoration:none"><font color="#3333CC"><i> 本书作者 </i></font></a>进行联系。</font>';
    }
 }

function sendemail()
{
 panel.style.visibility="hidden";
 mailwindow=window.open("sendmail.htm","mailwindow","height=200, width=300");
}

function winmove(evt)
{
 deltax=evt.x-initialX;
 deltay=evt.y-initialY;
 explorer.style.left=deltax+initialleft;

⌨️ 快捷键说明

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