JavaScript脚本

下拉菜单友情链接脚本 

<select name="myselect" size="1" onChange="javascript:window.open(this.options[this.selectedIndex].value)" style="BACKGROUND-COLOR: #e6e6fa; COLOR: rgb(0,0,255); width: 148px;">
<option selected>--明日科技站内导航--</option>
 
<option value="http://www.mingrisoft.com">ASP</option>
 
<option value="http://www.mingrisoft.com">JSP</option>
 
<option value="http://www.mingrisoft.com">VC++</option>
 
<option value="http://www.mingrisoft.com">VB</option>
</select>

 

解析式菜单

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<style type="text/css">
{
position:absolute;background: #eeffee;
//解释框背景色
}

</STYLE>
<SCRIPT LANGUAGE="JAVASCRIPT">
    CueMessage
=new Array(5)//创建数组
    CueMessage[0]="<font color=red><b>欢迎光临明日科技游戏网!</b></font>"
    CueMessage[
1]="<font color=red><b>进入游戏公告区,您可以了解最近的公告信息!</b></font>"
    CueMessage[
2]="<font color=red><b>可以帮助您对本站发行的积分进行了解!</b></font>"
    CueMessage[
3]="<font color=red><b>来这里,您可以知道如何购买本站的产品!</b></font>"
    CueMessage[
4]="<font color=red><b>为玩家提供交流的社区!</b></font>"
    
var br;//声明变量.用于指定浏览器
    if (document.all)
    
{
            lRef
='document.all.'
            styleRef
='.style.'
            CMessages
=".innerHTML=CueMessage[num]"
            CloseIt
=""
            br
=true
    }

    
else
    
{
       alert(
"此效果在Netscape浏览器中不能实现!");
    }

    
function www_mingrisoft_com(num)
    
{
        
if(br)
        
{
            eval(lRef
+'www_mingrisoft_com'+CMessages)
            eval(lRef
+'www_mingrisoft_com'+CloseIt);
        }

    }

</SCRIPT>
</head>
<body style="text-align: center">
    
&nbsp;<table cellspacing="0" cellpadding="0">
  
<tr>
    
<td style="height: 30px">
         
<a href="http://www.mingrisoft.com"  onMouseOver="www_mingrisoft_com(0)" onMouseOut="www_mingrisoft_com(5)" target="_blank">
             
<span style="font-size: 11pt; color: #0000ff">本站首页</span></a> 
    
</td>
  
</tr>
    
<tr>
        
<td style="height: 30px">
         
<a href="http://www.mingrisoft.com" onMouseOver="www_mingrisoft_com(1)" onMouseOut="www_mingrisoft_com(5)" target="_blank">
             
<span style="font-size: 11pt; color: #0000ff">游戏公告</span></a>
        
</td>
    
</tr>
    
<tr>
        
<td style="height: 30px">
        
<a href="http://www.mingrisoft.com"  onMouseOver="www_mingrisoft_com(2)" onMouseOut="www_mingrisoft_com(5)" target="_blank">
            
<span style="font-size: 11pt; color: #0000ff;">积分乐园</span></a>
        
</td>
    
</tr>
    
<tr>
        
<td style="height: 30px">
        
<a href="http://www.mingrisoft.com"  onMouseOver="www_mingrisoft_com(3)" onMouseOut="www_mingrisoft_com(5)" target="_blank">
            
<span style="font-size: 11pt; color: #0000ff">汇款方式</span></a>
        
</td>
    
</tr>
    
<tr>
        
<td style="height: 30px">
        
<a href="http://www.mingrisoft.com"  onMouseOver="www_mingrisoft_com(4)" onMouseOut="www_mingrisoft_com(5)" target="_blank">
            
<span style="font-size: 11pt; color: #0000ff">玩家论坛</span></a>
        
</td>
    
</tr>
</table>
    
<br />
<div id="www_mingrisoft_com" style="left: 220px; top: 69px; width: 299px; height: 40px"></div>
</body>
</html>

 

下拉式菜单:

<html>
<head>
<title>自动隐藏式菜单</title>
<style>#dviID {
    BACKGROUND
-COLOR: #66cdaa; 
    BORDER
-BOTTOM: white 2px outset; 
    BORDER
-LEFT: white 2px outset; 
    BORDER
-RIGHT: white 2px outset; 
    BORDER
-TOP: white 2px outset; 
    LEFT: 0px; POSITION: absolute; 
    TOP: 0px; VISIBILITY: hidden; 
    WIDTH: 200px; 
    layer
-background-color: #e6e6fa
}

a
{font-size:9pt}
a:link
{text-decoration:none}
a:hover
{text-decoration:none;color:#FFFFFF}
a:visited
{text-decoration:none}
.40pt
{font-size:40pt;color:#e6e6fa;font-family:文鼎琥珀繁}
</style>
<script language="javascript">
a
=null
b
=null
c
=null
d
=null
Netscape4 
= (document.layers)?1:0
IE4 
= (document.all)?1:0;
function MenuHide() //菜单隐藏
{
    
if(Netscape4) 
    
{
        clearTimeout(d)
        
if( menu.top > menuH*-1+20+10 ) 
        
{  
            menu.top 
-= 10
            c 
= setTimeout("MenuHide()"1)
        }

        
else if( menu.top > menuH*-1+20 ) 
        
{
            menu.top
--
            c 
= setTimeout("MenuHide()"1)
        }

    }

    
else 
    

        clearTimeout(d)
        
if( menu.pixelTop > menuH*-1+20+10 ) 
        
{
            menu.pixelTop 
-= 10
            c 
= setTimeout("MenuHide()"1
        }

        
else if( menu.pixelTop > menuH*-1+20 ) 
        
{
            menu.pixelTop
--
            c 
= setTimeout("MenuHide()"1)
        }

    }

}

function MenuOut() //菜单显示
{
    
if(Netscape4) 
    
{
        clearTimeout(c)
        
if( menu.top < -10
        

            menu.top 
+= 4
            d 
= setTimeout("MenuOut()"1)
        }

        
else if( menu.top < 0
        

            menu.top
++
            d 
= setTimeout("MenuOut()"1)
        }

    }

    
else 
    

        clearTimeout(c)
        
if( menu.pixelTop < -10
        
{
            menu.pixelTop 
+= 2
            d 
= setTimeout("MenuOut()"1)
        }

        
else if( menu.pixelTop < 0 ) 
        
{
            menu.pixelTop
++
            d 
= setTimeout("MenuOut()"1)
        }

    }

}

function fireOver() 

    clearTimeout(b)           
    a 
= setTimeout("MenuOut()"10
}

function fireOut() 

    clearTimeout(a)
    b 
= setTimeout("MenuHide()"10)
}

function Init() 
{
    
if(Netscape4) 
    
{
        menu 
= document.D1
        menuH 
= menu.document.height
        menu.top 
= menu.document.height*-1+20 
        menu.onmouseover 
= menuOut
        menu.onmouseout 
= menuIn
        menu.visibility 
= "visible"
    }

    
else if(IE4) 
    
{
        menu 
= dviID.style
        menuH 
= dviID.offsetHeight
        dviID.style.pixelTop 
= dviID.offsetHeight*-1+20
        dviID.onmouseover 
= fireOver
        dviID.onmouseout 
= fireOut
        dviID.style.visibility 
= "visible"
    }

}


</script>
</head>

<body onload="Init()" >
<div id="dviID" >

<table border="0" width="294">
<TBODY>
  
<tr>
    
<td align="middle" bgColor="#2e8b57" rowSpan="2" style="width: 14px"><font color="#e0ffff">
    菜
<br>
    单
</font></td>
    
<td width="127"> <ul>
      
<li><a href="javascript:void(0)">ASP图书</a>  
      
</li>
      
<li><a href="javascript:void(0)">JSP图书</a>  
      
</li>
      
<li><a href="javascript:void(0)">ASP.NET图书</a>  
      
</li>
      
<li><a href="javascript:void(0)">VB图书</a>  
      
</li>
      
<li><a href="javascript:void(0)">C#.NET图书</a>  
      
</li>
      
<li><a href="javascript:void(0)">.NET 2.0图书</a>  
      
</li>
    
</ul>
    
</td>
    
<td width="133">
    
</td>
  
</tr>
  
<tr>
    
<td align="right" colSpan="2" width="266">
    
</td>
  
</tr>
</TBODY>
</table>
</div>
</body>

网站启动弹出窗口

<script language="javascript">
    window.open(
"Default2.aspx","new","height=230,width=250,top=10,left=20")

弹出居中页面:

    <script language="javascript">
    
function manage(){
        
var hdc=window.open('Default2.aspx','','width=300,height=200');
        width
=screen.width;
        height
=screen.height;
        hdc.moveTo((width
-300)/2,(height-200)/2);
    }

</script>

 弹出窗口,有点auto性质

    <title>弹出网页模式对话框</title>
    
<script language="javascript">
    
function opendialog()
    
{
    
var someValue=window.showModalDialog("Default2.aspx","","dialogWidth=300px;dialogHeight=200px;status=no;help=no;scrollbars=no")
    document.form1.TextBox1.value
=someValue;
    }

</script>

 

 全屏模式代码

 

    <script language="javascript">
    
function opendialog(){
    
var width=screen.width;
    
var height=screen.height;
    window.showModalDialog(
"Default.aspx","","dialogWidth="+width+"px;dialogHeight="+height+"px;status=no;help=no;scrollbars=no")
    }

    
</script>

 

取色器代码

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    
<title>无标题页</title>
</head>
<body>
<script language="JavaScript">
<!--
var h = new Array(6)
h[
0= "FF";
h[
1= "CC";
h[
2= "99";
h[
3= "66";
h[
4= "33";
h[
5= "00";
function action(RGB) {
 
//alert('您选择的颜色是:#'+RGB);
 parent.window.returnValue="#"+RGB;
 window.close();
}

function Mcell(R, G, B) {
 document.write(
'<td bgcolor="#' + R + G + B + '">');
 document.write(
'<a href="#" onClick="action('' + (R + G + B) + '')">');
 document.write(
'<img border=0 height=12 width=12 ')" alt='#'+R+G+B+''>');
 document.write(
'</a>');
 document.write(
'</td>');
}

function Mtr(R, B) {
 document.write(
'<tr>');
 
for (var i = 0; i < 6++i) {
  Mcell(R, h[i], B);
 }

 document.write(
'</tr>')
}

function Mtable(B) {
 document.write(
'<table cellpadding=0 cellspacing=0 border=0>');
 
for (var i = 0; i < 6++i) {
  Mtr(h[i], B);
 }

document.write(
'</table>');
}

function Mcube() {
 document.write(
'<table cellpadding=0 cellspacing=0 border=0><tr>');  //
 for (var i = 0; i < 6++i) {
   
if(i%3==0){
   document.write(
'<tr>');
   }

  document.write(
'<td bgcolor="#FFFFFF">');
  Mtable(h[i])
  document.write(
'</td>');
 }

   
if(i%3==0){
   document.write(
'</tr>');
   }

 document.write(
'</tr></table>');
}

Mcube()

 
-->

  
</script>

</body>
</html>

 

 

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值