几种javascript

1

--------------------------------------------------------------------

<BODY>
<input type="file" name='a1'><input type="button" value='复制粘贴' οnclick="haha()"><div id="aa"></div>
<SCRIPT LANGUAGE="JavaScript">
<!--
function haha()
{
clipboardData.setData("Text",a1.value);
aa.innerText=clipboardData.getData("Text");
}
//-->
</SCRIPT>
</BODY>

--------------------------------------------------------------------

2

--------------------------------------------------------------------

<%@ page contentType="text/html; charset=gbk" %>
<html>
<style type="text/css">
<!--
td{border-left-style:solid; border-left-color:blue; border-left-width:1px;border-top-style:solid; border-top-color:blue; border-top-width:1px;}

-->
</style>


<script type="text/javascript" language="javascript">
function change(obj)
{
obj.style.borderLeftStyle ="solid";
obj.style.borderLeftWidth ="2";
obj.style.borderLeftColor ="blue";
obj.style.borderTopStyle ="solid";
obj.style.borderTopWidth ="2";
obj.style.borderTopColor ="blue";
}
function backstyle(obj)
{
obj
obj.style.borderLeftStyle ="solid";
obj.style.borderLeftWidth ="1";
obj.style.borderLeftColor ="blue";
obj.style.borderTopStyle ="solid";
obj.style.borderTopWidth ="1";
obj.style.borderTopColor ="blue";
}
</script>
<body>
<table border="0"  cellpadding="0" cellspacing="0" bgcolor="lightblue">

<tr>
<td onMouseOver="change(this)" class="" onMouseOut="backstyle(this)" >1</td>
<td onMouseOver="change(this)" class="" onMouseOut="backstyle(this)" >2222</td>
<td onMouseOver="change(this)" class="" onMouseOut="backstyle(this)" >33333</td>
</tr>
<tr >
<td onMouseOver="change(this)" class="" onMouseOut="backstyle(this)" >44444</td>
<td onMouseOver="change(this)" class="" onMouseOut="backstyle(this)" >55555</td>
<td onMouseOver="change(this)" class="" onMouseOut="backstyle(this)" >66666</td>
</tr>
<tr>
<td onMouseOver="change(this)" class="" onMouseOut="backstyle(this)" >77777</td>
<td onMouseOver="change(this)" class="" onMouseOut="backstyle(this)" >88888</td>
<td onMouseOver="change(this)" class="" onMouseOut="backstyle(this)" >999999</td>
</tr>
</table>
</body>
</html>

 -----------------------------------------------------------------------------------------------

3

-----------------------------------------------------------------------------------------------

<!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" xml:lang="en">
<head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
</head>
<body>
<div class="block">
 
     <li>
      <img style="display:block;cursor:pointer;" src="http://home.blueidea.com/attachment/201106/2/498048_13070269434RZR_t.png" alt="on"       width="50" height="50" οnclick="onopen(this)"/>
 
      <ul>
   wwww
        <li>123132</li>
        <li>123132</li>
        <li>123132</li>
      </ul>
    </li>
</div>
<script type="text/javascript">
 function onopen(value)
 {
 if(value.parentNode.getElementsByTagName('ul')[0].style.display=='block')
 {
 value.parentNode.getElementsByTagName('ul')[0].style.display = 'none';
}
else
{
value.parentNode.getElementsByTagName('ul')[0].style.display = 'block';
}
}
</script>
</body>
</html>

 ----------------------------------------------------------------------------------------------

4

-----------------------------------------------------------------------------------------------
 
 

<html>


<body>

 


输入框景背景透明:
<input style="background:transparent;border:1px solid #ffffff">

鼠标划过输入框,输入框背景色变色:
<INPUT value="Type here" NAME="user_pass" TYPE="text" SIZE="29" οnmοuseοver="this.style.borderColor='black';this.style.backgroundColor='plum'"
style="width: 106; height: 21"
οnmοuseοut="this.style.borderColor='black';this.style.backgroundColor='#ffffff'" style="border-width:1px;border-color=black">

输入字时输入框边框闪烁(边框为小方型):
<Script Language="JavaScript">
function borderColor(){
if(self['oText'].style.borderColor=='red'){
self['oText'].style.borderColor = 'yellow';
}else{
self['oText'].style.borderColor = 'red';
}
oTime = setTimeout('borderColor()',400);
}
</Script>
<input type="text" id="oText" style="border:5px dotted red;color:red" οnfοcus="borderColor(this);" οnblur="clearTimeout(oTime);">

输入字时输入框边框闪烁(边框为虚线):
<style>
#oText{border:1px dotted #ff0000;ryo:expression(οnfοcus=function light (){with(document.all.oText){style.borderColor=(style.borderColor=="#ffee00"?"#ff0000":"#ffee00");timer=setTimeout(light,500);}},οnblur=function(){this.style.borderColor="#ff0000";clearTimeout(timer)})};
</style>
<input type="text" id="oText">

自动横向廷伸的输入框:
<input type="text" style="huerreson:expression(this.width=this.scrollWidth)" value="abcdefghijk">

自动向下廷伸的文本框:
<textarea name="content" rows="6" cols="80" onpropertychange="if(this.scrollHeight>80) this.style.posHeight=this.scrollHeight+5">输入几个回车试试</textarea>

只有下划线的文本框:
<input style="border:0;border-bottom:1 solid black;background:;">

软件序列号式的输入框:
<script for="T" event="onkeyup">
if(value.length==3)document.all[event.srcElement.sourceIndex+1].select();
</script>
<input name="T" size="5" maxlength="3">—<input name="T" size="5" maxlength="3">—<input name="T" size="5" maxlength="3">—<input name="T" size="5" maxlength="3">—<input name="T" size="5" maxlength="3">—<input name="T7" size="5" maxlength="3">

软件序列号式的输入框(完整版):
<script for="T" event="onkeyup">if(value.length==maxLength)document.all[event.srcElement.sourceIndex+1].focus();</script>
<script for="T" event="onfocus">select();</script>
<script for="Submit" event="onclick">
var sn=new Array();
for(i=0;i<T.length;i++)
sn=T.value;
alert(sn.join("—"));
</script>
<input name="T" size="5" maxlength="3">—<input name="T" size="5" maxlength="3">—<input name="T" size="5" maxlength="3">—<input name="T" size="5" maxlength="3">—<input name="T" size="5" maxlength="3">—<input name="T" size="5" maxlength="3">
<input type="submit" name="Submit">

 

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/luo_yifan/archive/2011/02/15/6185608.aspx
</body>
</html>

-------------------------------------------------------------------------------------------------------------------------------------

5

-------------------------------------------------------------------------------------------------------------------------------------
 

<html>
<head>
    <title></title>
    <script>
    function textEnable(obj){
    if(obj.checked)
    document.getElementById("text1").disabled=true;
    else
     document.getElementById("text1").disabled=false;
    }
    </script>
</head>

<body>
<input type="text" id="text1"/>
<input type="checkbox" id="cb" value="select" οnclick="textEnable(this);"/>
</body>
</html>

 --------------------------------------------------------------------------------------------------

6

---------------------------------------------------------------------------------------------------

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<style type="text/css">
table{ border-color:#0000FF; border-style:solid; border-width:1px}
</style>

<script type="text/javascript">
 var i=1;
function run(obj)
{
obj.style.width="500";
obj.style.height="500";

}
function backstyle(obj)
{
obj.style.width="40";
obj.style.height="60";

}
</script>

<body>
<table align="center">
<td>
<img src="img/100.jpg" οnmοusemοve="run(this)" οnmοuseοut="backstyle(this)" style="width:40px; height:60px;"/>

</td>
<td>
<img src="img/101.jpg" οnmοusemοve="run(this)" οnmοuseοut="backstyle(this)" style="width:40px; height:60px;"/>

</td>

<td>
<img src="img/102.jpg" οnmοusemοve="run(this)" οnmοuseοut="backstyle(this)" style="width:40px; height:60px;"/>
</td>
<td>
<img src="img/103.jpg" οnmοusemοve="run(this)" οnmοuseοut="backstyle(this)" style="width:40px; height:60px;" />
</td>

<tr>

 


</tr>


</table>

 

</body>
</html>

----------------------------------------------------------------------------------

7

----------------------------------------------------------------------------------

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<script type="text/javascript">
 var i=1;
function run()
{
var obj=document.getElementById("img");
obj.src="img/"+i+".gif";
i++;
if(i==15)
{i=1;}
}
</script>

<body>


<div style="width:50px; height:50px">
<img src="img/1.gif" id="img" οnclick="run(this)" />


</div>

 

<script type="text/javascript" language="javascript">
 setInterval("run()",1000);
</script>
</body>
</html>

--------------------------------------------------------------------------------

 8

-------------------------------------------------------------------------------

<html>
<head>
<script type="text/javascript" language="javascript">
function openpage()
{
window.open("2.html","newwindow","");
}
</script>
</head>
<body onLoad="openpage()">

</body>
</html>

---------------------------------------------------------------------------------

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值