js调用技能

js调用技能

JS 初级、中级、高级技巧集锦
--------------------------------------------------------------------------------

初级篇 1.让文字不停地滚动

  <MARQUEE>滚动文字</MARQUEE>

  2.记录并显示网页的最后修改时间

  <script language=JavaScript>
  document.write("最后更新时间: " + document.lastModified + "")
  </script>

  3.关闭当前窗口

  <a href="/"onClick="javascript :window.close();return false;">关闭窗口</a>

  4.2秒后关闭当前页

  <script language="JavaScript">
  <!--
  setTimeout('window.close();',2000);
  -->
  </script>

  5.2秒后载入指定网页

  <head>
  <meta http-equiv="refresh" content="2;URL=http://你的网址">
  </head>

  6.添加到收藏夹

  <Script Language="JavaScript">
  function bookmarkit()
  {
  window.external.addFavorite('http://你的网址','你的网站名称')
  }
  if (document.all)document.write('<a href="#" onClick="bookmarkit()">加入收藏夹</a>')
  </Script>

  7.让超链接不显示下划线

  <style type="text/css">
  <!-
  a:link{text-decoration:none}
  a:hover{text-decoration:none}
  a:visited{text-decoration:none}
  ->
  </style>

  8.禁止鼠标右键的动作

  <Script Language = "JavaScript">
  function click() { if (event.button==2event.button==3)
  {
  alert('禁止鼠标右键');
  }
  document.οnmοusedοwn=click // -->
  </Script>

  9.设置该页为首页

  <body bgcolor="#FFFFFF" text="#000000">
  <!-- 网址:http://你的网址-->
  <a class="chlnk" style="cursor:hand" HREF
  onClick="this.style.behavior='url(#default#homepage)';
  this.setHomePage('你的网站名称);"><font color="000000" size="2" face="宋体">设为首页</font></a>
  </body>

中级篇

节日倒计时

<Script Language="JavaScript">
  var timedate= new Date("October 1,2005");
  var times="国庆节";
  var now = new Date();
  var date = timedate.getTime() - now.getTime();
  var time = Math.floor(date / (1000 * 60 * 60 * 24));
  if (time >= 0)
  document.write("现在离"+times+"还有: "+time +"天")</Script>
显示系统当前日期
<script language=JavaScript>
  today=new Date();
  function date(){
  this.length=date.arguments.length
  for(var i=0;i<this.length;i++)
  this[i+1]=date.arguments }
  var d=new date("星期日","星期一","星期二","星期三","星期四","星期五","星期六");
  document.write(
  "<font color=##000000 style='font-size:9pt;font-family: 宋体'> ",
  today.getYear(),"年",today.getMonth()+1,"月",today.getDate(),"日",
  d[today.getDay()+1],"</font>" );
  </script>

高级篇

  1.不同时间段显示不同问候语

  <Script Language="JavaScript">
  <!--
  var text=""; day = new Date( ); time = day.getHours( );
  if (( time>=0) && (time < 7 ))
    text="夜猫子,要注意身体哦! "
  if (( time >= 7 ) && (time < 12))
    text="今天的阳光真灿烂啊,你那个朋友呢?"
  if (( time >= 12) && (time < 14))
    text="午休时间。您要保持睡眠哦!"
  if (( time >=14) && (time < 18))
    text="祝您下午工作愉快! "
  if ((time >= 18) && (time <= 22))
    text="您又来了,可别和MM聊太久哦!"
  if ((time >= 22) && (time < 24))
    text="您应该休息了!"
  document.write(text)
  //--->
  </Script>

  2.水中倒影效果

  <img id="reflect" src="你自己的图片文件名" width="175" height="59">
  <script language="JavaScript">
  function f1()
  {
    setInterval("mdiv.filters.wave.phase+=10",100);
  }
  if (document.all)
  {
    document.write('<img id=mdiv src="'+document.all.reflect.src+'"
    style="filter:wave(strength=3,freq=3,phase=0,lightstrength=30) blur() flipv()">')
    window.οnlοad=f1
  }
  </script>

  3.慢慢变大的窗口

  <Script Language="JavaScript">
  <!--
  var Windowsheight=100
  var Windowswidth=100
  var numx=5
  function openwindow(thelocation){
  temploc=thelocation
  if
  (!(window.resizeTo&&document.all)&&!(window.resizeTo&&document.getElementById))
  {
    window.open(thelocation)
    return
  }
  windowsize=window.open("","","scrollbars")
  windowsize.moveTo(0,0)
  windowsize.resizeTo(100,100)
  tenumxt()
  }
  function tenumxt(){
  if (Windowsheight>=screen.availHeight-3)
    numx=0
  windowsize.resizeBy(5,numx)
  Windowsheight+=5
  Windowswidth+=5
  if (Windowswidth>=screen.width-5)
  {
    windowsize.location=temploc
    Windowsheight=100
    Windowswidth=100
    numx=5
    return
  }
  setTimeout("tenumxt()",50)
  }
  //-->
  </script>
  <p><a href="javascript :openwindow('http://www.ccjol.com')">进入</a>

  4.改变IE地址栏的IE图标

  我们要先做一个16*16的icon(图标文件),保存为index.ico。把这个图标文件上传到根目录下并在首页<head></head>之间加上如下代码:

  <link REL = "Shortcut Icon" href="index.ico">

5.让网页随意后退

  <a href="javascript :history.go(-X)">X</a> //把X换成你想要后退在页数
   //把“-”变成“+”就为前进

  6.鼠标指向时弹出信息框

  在<body></body>之间加上如下代码:

  <a href οnmοuseοver="alert('弹出信息!')">显示的链接文字</a>

  7.单击鼠标右键弹出添加收藏夹对话框

  在<body></body>之间加上如下代码:

  <Script Language=JavaScript>
  if (document.all)
  document.body.οnmοusedοwn=new Function("if (event.button==2event.button==3)
  window.external.addFavorite('您的网址','您的网站名称)")
  </Script>

  8.随机变换背景图象(一个可以刷新心情的特效)

  在<head></head>之间加上如下代码:

  <Script Language="JavaScript">
  image = new Array(4); //定义image为图片数量的数组
  image [0] = 'tu0.gif' //背景图象的路径
  image [1] = 'tu1.gif'
  image [2] = 'tu2.gif'
  image [3] = 'tu3.gif'
  image [4] = 'tu4.gif'
  number = Math.floor(Math.random() * image.length);
  document.write("<BODY BACKGROUND="+image[number]+">");
  </Script>

  9.鼠标一碰就给颜色看的链接

  在<body></body>之间加上如下代码:

  <p onMouseMove="anniu()">你敢碰我,我就给点颜色你看!</p>
  <Script Language = "VBScript">
  sub anniu
  document.fgColor=int(256*256*256*rnd)
  end sub
  </Script>

  10.从天而降并有幻影效果的窗口

  <head>
  <Script language="JavaScript">
  function move(x) {
  if(self.moveBy){
  self.moveBy (0,-800);
  for(i = x; i > 0; i--)
  {
  self.moveBy(0,3);
  }
  for(j = 200; j > 0; j--){ //如果你认为窗口抖动厉害,就200换成个位数
  self.moveBy(0,j);
  self.moveBy(j,0);
  self.moveBy(0,-j);
  self.moveBy(-j,0);
  }
  }
  }
  </Scrip>
  <body bgColor=#ffffff οnlοad=move(280)>
  </body>
  </head>

  11.表格的半透明显示效果

  在<head></head>之间加上如下代码:

  <style>
  .alpha{filter: Alpha(Opacity=50)} //50表示50%的透明度
  </style>

  在<body></body>之间加上如下代码:
  <table border="1" width="100" height="62" class="alpha" bgcolor="#F2A664" >
  <tr>
  <td width="100%" height="62">
  <div align="center">很酷吧!</div>
  </td>
  </tr>
  </table>


JS常用代码

作者:lyjier 日期:2007-02-05

1.网页按钮的特殊颜色
<input type=button name="Submit1" value="按钮" size=10 class=s02 style="background-color:rgb(235,207,22)">

2.鼠标移入移出时颜色变化
<input type="submit" value="找吧" name="B1" onMouseOut=this.style.color="blue" onMouseOver=this.style.color="red"  class="button">

3.平面按钮
<input type=submit value=订阅 style="border:1px solid :#666666; height:17px; width:25pt; font-size:9pt; BACKGROUND-COLOR: #E8E8FF; color:#666666" name="submit">

4.按钮颜色变化
<input type=text name="nick"  style="border:1px solid #666666;  font-size:9pt;  height:17px; BACKGROUND-COLOR: #F4F4FF; color:#ff6600" size="15" maxlength="16">

5.平面输入框
<input type="text" name="T1" size="20" style="border-style: solid; border-width: 1">

6.使窗口变成指定的大小
<script>
window.resizeTo(300,283);
</script>

7.使文字上下滚动
<marquee direction=up scrollamount=1 scrolldelay=100 οnmοuseοver='this.stop()' οnmοuseοut='this.start()' height=60>
<!-- head_scrolltext -->
<tr>
<td>
上下滚动的文字
</table>        <!-- end head_scrolltext -->
</marquee>

8.点击文字实现radio选项的选定
<br>
    <input type="radio" name="regtype" value="A03" id="A03">
<label for="A03"> 你好: 欢迎光临</label> <br>

9.线型输入框
<input type="text" name="key"  size="12" value="关键字" onFocus=this.select() onMouseOver=this.focus() class="line">

10.显示文档最后修改日期
<script language=javascript>
function hi(str)
{
document.write(document.lastModified)
alert("hi"+str+"!")
}
</script>

11.可以在鼠标移到文字上时就触发事件
<html>
<head>
<script language="LiveScript">
<!-- Hiding
    function hello() {
      alert("哈罗!");
    }
</script>
</head>
<body>
<a href="" onMouseOver="hello()">link</a>
</body>
</html>

12.可以根据网页上的选项来确定页面颜色
<HTML>
<HEAD>
<TITLE>background.html</TITLE>
</HEAD>
<SCRIPT>
<!--

function bgChange(selObj) {
newColor = selObj.opti*****[selObj.selectedIndex].text;
document.bgColor = newColor;
selObj.selectedIndex = -1;
}

//-->
</SCRIPT>
<BODY STYLE="font-family:Arial">
<B>Changing Background Colors</B>
<BR>
<FORM>
  <Select SIZE="8" onChange="bgChange(this);">
  <OPTION>Red
  <OPTION>Orange
  <OPTION>Yellow
  <OPTION>Green
  <OPTION>Blue
  <OPTION>Indigo
  <OPTION>Violet
  <OPTION>White
<OPTION>pink
  </Select>
</FORM>
</BODY>
</HTML>

13.将按钮的特征改变
<style type="text/CSS">
<!--
.style1 { font-size: 12px; background: #CCCCFF; border-width: thin thin thin thin; border-color: #CCCCFF #CCCCCC #CCCCCC #CCCCFF}
.style2 { font-size: 12px; font-weight: bold; background: #CCFFCC; border-width: thin medium medium thin; border-color: #CCFF99 #999999 #999999 #CCFF99}
-->
</style>
本例按钮的代码如下:
<input type="submit" name="Submit" value="提 交" οnmοuseοver="this.className='style2'"
οnmοuseοut="this.className='style1'" class="style1">

14.改变按钮的图片.
<style type="text/css">
<!--
.style3 { font-size: 12px; background: url(image/buttonbg1.gif); border: 0px; width: 60px; height: 22px}
.style4 { font-size: 12px; font-weight: bold; background: url(image/buttonbg2.gif); border: 0px 0; width: 60px; height: 22px}
-->
</style>
本例的按钮代码如下:
<input type="submit" name="Submit2" value="提 交" οnmοuseοver="this.className='style4'"
οnmοuseοut="this.className='style3'" class="style3">

15.改变下拉框的颜色
<select name="classid"
onChange="changelocation(document.myform.classid.opti*****[document.myform.classid.selectedIndex].value)" size="1" style="color:#008080;font-size: 9pt">

16.转至目标URL
window.location="http://www.cxblog.net"

17.过10秒自动关闭页面
< script language="JavaScript" >
function closeit() {
setTimeout("self.close()",10000)
}
< /script >

18.可以比较字符的大小
char=post.charAt(i);
if(!('0'<=char&&char<='9'))

19.将字符转化为数字
month = parseInt(char)

20.点击value非空的选项时转向指定连接
<select οnchange='if(this.value!="")window.open(this.value)' class="textinput">
    <option selected>主办单位</option>
    <option>-----------------</option>
    <option value="http://www.bjd.com.cn/">北京日报</option>
    <option value="http://www.ben.com.cn/">北京晚报</option>
</select>

21.改变文字输入框的背景颜色
<style>
.input2 {background-image: url('../images/inputbg.gif');  font-size: 12px; background-color: #D0DABB;border-top-width:1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px}
</style>
<input name=content type=text size="47" class="input2" maxlength="50">

22.改变水平线的特征
<hr size="0" noshade color="#C0C0C0">

23.两个按键一起按下
if(event.ctrlKey && window.event.keyCode==13)//

24.刷新页面
javascript :this.location.reload()//

25.双击网页自动跑
<SCRIPT LANGUAGE="JavaScript">
var currentpos,timer;
function initialize()
{
timer=setInterval("scrollwindow()",1);
}
function sc()
{
clearInterval(timer);
}
function scrollwindow()
{
currentpos=document.body.scrollTop;
window.scroll(0,++currentpos);
if (currentpos != document.body.scrollTop)
  sc();
}
document.οnmοusedοwn=sc
document.οndblclick=initialize
</SCRIPT>//

26.后退
<INPUT TYPE="button" οnclick=window.history.back() value=back>

27.前进
<INPUT TYPE="button" οnclick=window.history.forward() value=forward>

28.刷新
<INPUT TYPE="button" οnclick=document.location.reload() value=reload>

29.在网页上显示实时时间
<SCRIPT LANGUAGE="JavaScript">
var clock_id;
window.οnlοad=function()
{
clock_id=setInterval("document.form1.txtclock.value=(new Date);",1000)
}
</SCRIPT>//

30.可以改变页面上的连接的格式,使其为双线
<style>
A:link {text-decoration: none; color:#0000FF; font-family: 宋体}
A:visited {text-decoration: none; color: #0000FF; font-family: 宋体}
A:hover {text-decoration: underline overline; color: FF0000}
</style>

<style>
A:link {text-decoration: none; color:#0000FF; font-family: 宋体}
A:visited {text-decoration: none; color: #0000FF; font-family: 宋体}
A:hover {text-decoration: underline overline line-through; color: FF0000}
TH{FONT-SIZE: 9pt}
TD{FONT-SIZE: 9pt}
body {SCROLLBAR-FACE-COLOR: #A9D46D; SCROLLBAR-HIGHLIGHT-COLOR: #e7e7e7;SCROLLBAR-SHADOW-COLOR:#e7e7e7; SCROLLBAR-3DLIGHT-COLOR: #000000; LINE-HEIGHT: 15pt; SCROLLBAR-ARROW-COLOR: #ffffff; SCROLLBAR-TRACK-COLOR: #e7e7e7;}

INPUT{BORDER-TOP-WIDTH: 1px; PADDING-RIGHT: 1px; PADDING-LEFT: 1px; BORDER-LEFT-WIDTH: 1px; FONT-SIZE: 9pt; BORDER-LEFT-COLOR: #cccccc; BORDER-BOTTOM-WIDTH: 1px; BORDER-BOTTOM-COLOR: #cccccc; PADDING-BOTTOM: 1px; BORDER-TOP-COLOR: #cccccc; PADDING-TOP: 1px; HEIGHT: 18px; BORDER-RIGHT-WIDTH: 1px; BORDER-RIGHT-COLOR: #cccccc}
DIV,form ,OPTION,P,TD,BR{FONT-FAMILY: 宋体; FONT-SIZE: 9pt}
textarea, select {border-width: 1; border-color: #000000; background-color: #efefef; font-family: 宋体; font-size: 9pt; font-style: bold;}
.text { font-family: "宋体"; font-size: 9pt; color: #003300; border: #006600 solid; border-width: 1px 1px 1px 1px}
</style>完整的css


31.直线型输入框
<INPUT name=Password size=10 type=password style="border-left-width: 0; border-right-width: 0; border-top-width: 0; border-bottom-style: solid; border-bottom-width: 1; background-color: #9CEB9C">

32.以下是一个完整的显示hint的代码,其思想是当鼠标停留是将div中的内容显示在鼠标出,当鼠标移出后在将该div隐藏掉
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<style>
#hint{
width:198px;
border:1px solid #000000;
background:#99ff33;
position:absolute;
z-index:9;
padding:6px;
line-height:17px;
text-align:left;
top: 1520px;
}
</style>
<SCRIPT LANGUAGE="JavaScript">
<!--
function showme()
{
var oSon=window.document.getElementById("hint");
if (oSon==null) return;
with (oSon)
{
  innerText=guoguo.value;
  style.display="block";
  style.pixelLeft=window.event.clientX+window.document.body.scrollLeft+6;
  style.pixelTop=window.event.clientY+window.document.body.scrollTop+9;
}
}
function hidme()
{
var oSon=window.document.getElementById("hint");
if (oSon==null) return;
oSon.style.display="none";
}
//-->
</SCRIPT>
<BODY>
<text id=guoguo value=ga>
<a href=# οnmοuseοver=showme() οnmοuseοut=hidme() οnmοusemοve=showme() son=hint>dfdfd</a>
<div id=hint style="display:none"></div>
</BODY>
</HTML>
-------------------------------------------------------------------------

33.弹出窗口
方法一:<body οnlοad="openwen()"> 浏览器读页面时弹出窗口;
方法二:<body οnunlοad="openwen()"> 浏览器离开页面时弹出窗口;
方法三:用一个连接调用:<a href="#" οnclick="openwin()">打开一个窗口</a>
注意:使用的"#"是虚连接。
方法四:用一个按钮调用:<input type="button" οnclick="openwin()" value="打开窗口"> 何时装载script

34.判断是何种浏览器
var name = navigator.appName;
if (name == "Microsoft Internet Explorer")
alert("IE");
else if (name == "Netscape")
alert("NS");//

35.最小化窗口
window.blur()//

36.设置为主页
function makeHome(){
  netscape.security.PrivilegeManager.enablePrivilege("UniversalPreferencesWrite");
  navigator.preference("browser.startup.homepage", location.href);
}//

37.设置为收藏
function addFav(){
  if(ie)
    window.external.AddFavorite(location.href,'WWW.OGRISH.COM : GROTESQUE MOVIES AND PICTURES');
  if(ns)
    alert("Thanks for the bookmark!/n/nNetscape users click OK then press CTRL-D");
}//

38.判断cookie是否可用
navigator.cookieEnabled;//

39.禁止选择页面上的文字来拷贝
<script>
function noEffect() {
  with (event) {
    returnValue = false;
    cancelBubble = true;
  }
  return;
}
</script>
<body *****electstart="noEffect()" οncοntextmenu="noEffect()">//

40.屏蔽右键菜单
οncοntextmenu="event.returnValue = false"//

41.禁止在输入框打开输入法
<input style="ime-mode: disabled">//

42.屏蔽汉字和空格
<input name="txt"><input type="submit" onClick="alert(!/[^ -}]|/s/.test(txt.value))">//

43.获得当前的文本框选中的文字
<input οnmοuseup="alert(document.selection.createRange().text)" value=123>//

44.跳转至目标页面,同时不可返回
<a href="javascript :location.replace('http://www.sohu.com/')">sohu.com</a>//

45.打开C盘
<form action="file:///c|/"><input type="submit" value="c:/ drive"></form>//

46.当前屏幕的分辨率
screen.width、screen.height//

47.本地快捷键
<a href="file:///::{208D2C60-3AEA-1069-A2D7-08002B30309D}" target="_blank">网上邻居</a>
<a href="file:///::{20D04FE0-3AEA-1069-A2D8-08002B30309D}/d:/web" target="_blank">我的电脑</a>
<a href="file:///::{450D8FBA-AD25-11D0-98A8-0800361B1103}" target="_blank">我的文档</a>
<a href="file:///::{645FF040-5081-101B-9F08-00AA002F954E}" target="_blank">回收站</a>
<a href="file:///::{20D04FE0-3AEA-1069-A2D8-08002B30309D}/::{21EC2020-3AEA-1069-A2DD-08002B30309D}" target="_blank">控制面板</a>
<a href="file:///::{7007ACC7-3202-11D1-AAD2-00805FC1270E}">拨号网络</a>(Windows 2000)

 
48.IE菜单
<button οnclick="min.Click()"><font face="webdings">0</font></button>//改变按钮上的图片
<input type=button  οnclick="document.execCommand('CreateLink','true','true')"> //创建新连接
<input type=button  οnclick="document.execCommand('print','true','true')"> //打印
<input type=button  οnclick="document.execCommand('saveas','true','网站制作.htm')">//另存为htm
<input type=button  οnclick="document.execCommand('saveas','true','网站制作.txt')">//另存为txt
document.execCommand("SaveAs")//保存为
document.execCommand('undo')//撤销上一次操作

49.web对话框
<SCRIPT>
var contents='<style>body,td{font:menu}img{cursor:hand}</style>';
contents+='<title>你要关闭我吗</title>';
contents+='<body bgcolor=menu>';
contents+='<table width=100% height=100% border=0>';
contents+='<tr><td align=center>';
contents+='你要关闭我吗?<br>';
contents+='<img src=dark.gif οnclick=self.close() alt="...关闭">';
contents+='<img src=jet.gif οnclick=self.close() alt="全是关闭">';
contents+='</td></tr></table>';
showModalDialog("about:"+contents+"","","dialogHeight:50px;dialogWidth:250px;help:no;status:no")
document.write(contents);
</SCRIPT>//

50.鼠标移到下拉框时自动全部打开
<select οnmοuseοver="javascript :this.size=this.length" οnmοuseοut="javascript :this.size=1"></select>//

51.一个特殊的容器,想装个网页都行
<button><iframe src="http://www.google.com/"></iframe></button>//button

52.页面翻转
<html dir=rtl></html>//

53.滚屏
parent.scroll(x,y);//
<body οnlοad="s=0" onDblClick="s=setInterval('scrollBy(0, 1)',10)" onClick="clearInterval(s)">//

54.改变状态栏
self.status ="";//

55.改变鼠标样式
style
BODY{CURSOR: url('mouse.ani');
SCROLLBAR-BASE-COLOR: #506AA8;
SCROLLBAR-ARROW-COLOR: #14213F;
}//

56.背景透明
<input type="button" value="Button" style="background-color: transparent; border: 0;">//

57.获得操作系统的名称和浏览器的名称
document.write(navigator.userAgent)//

58.滚动条滚动
<button οnclick="text1.scrollTop=text1.scrollHeight">Scroll</button><br>
<textarea id="text1" cols=50 rows=10>
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
</textarea>//

59.让下拉框自动下拉
<select οnmοuseοver="javascript :this.size=this.length" οnmοuseοut="javascript :this.size=1">
<option value="">1</option>
<option value="">2</option>
<option value="">3</option>
</select> //

60.判断一个数字是否是整数
var a=23.2;
alert(a%1==1)//

61.新建日期型变量
var a = new Date(2000, 1, 1);
alert(a.toLocaleDateString());

62.生成Excel文件并保存
var ExcelSheet;
ExcelApp = new ActiveXObject("Excel.Application");
ExcelSheet = new ActiveXObject("Excel.Sheet");
//本代码启动创建对象的应用程序(在这种情况下,Microsoft Excel 工作表)。一旦对象被创建,就可以用定义的对象变量在代码中引用它。 在下面的例子中,通过对象变量 ExcelSheet 访问新对象的属性和方法和其他 Excel 对象,包括 Application 对象和 ActiveSheet.Cells 集合。
// 使 Excel 通过 Application 对象可见。
ExcelSheet.Application.Visible = true;
// 将一些文本放置到表格的第一格中。
ExcelSheet.ActiveSheet.Cells(1,1).Value = "This is column A, row 1";
// 保存表格。
ExcelSheet.SaveAs("C://TEST.XLS");
// 用 Application 对象用 Quit 方法关闭 Excel。
ExcelSheet.Application.Quit();//

63.实现打印预览及打印
<OBJECT classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height=0 id=wb name=wb width=0></OBJECT>
<input type=button value=打印预览 οnclick="wb.execwb(7,1)">
<input type=button onClick=document.all.wb.ExecWB(6,1) value="打印">//

64.不通过form,直接通过名字引用对象
<INPUT TYPE="text" NAME="gg" value=aaaaa>
<SCRIPT LANGUAGE="JavaScript">
<!--
alert(document.all.gg.value)
//-->
</SCRIPT>//

65.使鼠标滚轮失效
function document.onmousewheel()
{
return false;
}//

66.将数字转化为人民币大写形式
function convertCurrency(currencyDigits) {
// C*****tants:
var MAXIMUM_NUMBER = 99999999999.99;
// Predefine the radix characters and currency symbols for output:
var CN_ZERO = "零";
var CN_ONE = "壹";
var CN_TWO = "贰";
var CN_THREE = "叁";
var CN_FOUR = "肆";
var CN_FIVE = "伍";
var CN_SIX = "陆";
var CN_SEVEN = "柒";
var CN_EIGHT = "捌";
var CN_NINE = "玖";
var CN_TEN = "拾";
var CN_HUNDRED = "佰";
var CN_THOUSAND = "仟";
var CN_TEN_THOUSAND = "万";
var CN_HUNDRED_MILLION = "亿";
var CN_SYMBOL = "人民币";
var CN_DOLLAR = "元";
var CN_TEN_CENT = "角";
var CN_CENT = "分";
var CN_INTEGER = "整";

// Variables:
var integral; // Represent integral part of digit number.
var decimal; // Represent decimal part of digit number.
var outputCharacters; // The output result.
var parts;
var digits, radices, bigRadices, decimals;
var zeroCount;
var i, p, d;
var quotient, modulus;

// Validate input string:
currencyDigits = currencyDigits.toString();
if (currencyDigits == "") {
  alert("Empty input!");
  return "";
}
if (currencyDigits.match(/[^,./d]/) != null) {
  alert("Invalid characters in the input string!");
  return "";
}
if ((currencyDigits).match(/^((/d{1,3}(,/d{3})*(.((/d{3},)*/d{1,3}))?)|(/d+(./d+)?))$/) == null) {
  alert("Illegal format of digit number!");
  return "";
}

// Normalize the format of input digits:
currencyDigits = currencyDigits.replace(/,/g, ""); // Remove comma delimiters.
currencyDigits = currencyDigits.replace(/^0+/, ""); // Trim zeros at the beginning.
// Assert the number is not greater than the maximum number.
if (Number(currencyDigits) > MAXIMUM_NUMBER) {
  alert("Too large a number to convert!");
  return "";
}

// http://www.cxblog.net/ Process the coversion from currency digits to characters:
// Separate integral and decimal parts before processing coversion:
parts = currencyDigits.split(".");
if (parts.length > 1) {
  integral = parts[0];
  decimal = parts[1];
  // Cut down redundant decimal digits that are after the second.
  decimal = decimal.substr(0, 2);
}
else {
  integral = parts[0];
  decimal = "";
}
// Prepare the characters corresponding to the digits:
digits = new Array(CN_ZERO, CN_ONE, CN_TWO, CN_THREE, CN_FOUR, CN_FIVE, CN_SIX, CN_SEVEN, CN_EIGHT,

CN_NINE);
radices = new Array("", CN_TEN, CN_HUNDRED, CN_THOUSAND);
bigRadices = new Array("", CN_TEN_THOUSAND, CN_HUNDRED_MILLION);
decimals = new Array(CN_TEN_CENT, CN_CENT);
// Start processing:
outputCharacters = "";
// Process integral part if it is larger than 0:
if (Number(integral) > 0) {
  zeroCount = 0;
  for (i = 0; i < integral.length; i++) {
  p = integral.length - i - 1;
  d = integral.substr(i, 1);
  quotient = p / 4;
  modulus = p % 4;
  if (d == "0") {
    zeroCount++;
  }
  else {
    if (zeroCount > 0)
    {
    outputCharacters += digits[0];
    }
    zeroCount = 0;
    outputCharacters += digits[Number(d)] + radices[modulus];
  }
  if (modulus == 0 && zeroCount < 4) {
    outputCharacters += bigRadices[quotient];
  }
  }
  outputCharacters += CN_DOLLAR;
}
// Process decimal part if there is:
if (decimal != "") {
  for (i = 0; i < decimal.length; i++) {
  d = decimal.substr(i, 1);
  if (d != "0") {
    outputCharacters += digits[Number(d)] + decimals;
  }
  }
}
// Confirm and return the final output string:
if (outputCharacters == "") {
  outputCharacters = CN_ZERO + CN_DOLLAR;
}
if (decimal == "") {
  outputCharacters += CN_INTEGER;
}
outputCharacters = CN_SYMBOL + outputCharacters;
return outputCharacters;
}//


67.取月的最后一天
function getLastDay(year,month)
{
//取年
var new_year = year;
//取到下一个月的第一天,注意这里传入的month是从1~12
var new_month = month++;
//如果当前是12月,则转至下一年
if(month>12)
{
  new_month -=12;
  new_year++;
}
var new_date = new Date(new_year,new_month,1);
return (new Date(new_date.getTime()-1000*60*60*24)).getDate();
}//

68.给下拉框分组
<Select>
<OPTGROUP LABEL="碱性金属">
<OPTION>锂 (Li)</OPTION>
<OPTION>纳 (Na)</OPTION>
<OPTION>钾 (K)</OPTION>
</OPTGROUP>
<OPTGROUP LABEL="卤素">
<OPTION>氟 (F)</OPTION>
<OPTION>氯 (Cl)</OPTION>
<OPTION>溴 (Br)</OPTION>
</OPTGROUP>
</Select>//

69.加注音
<RUBY>
基准文本
<RT>注音文本
</RUBY>//

70.加删除线
<S>此文本将带删除线显示。</S>//

71.防止链接文字折行
document.body.noWrap=true;//

72. 弹出新页面,关闭旧页面,不弹出提示框
  var w=screen.availWidth-10;
  var h=screen.availHeight-10;
  var swin=window.open("/mc/mc/message_management.jsp", "BGSMbest","scrollbars=yes,status,location=0,menubar=0,toolbar=0,resizable=no,top=0,left=0,height="+h+",width="+w);
  window.opener=null;
  window.close();//

73.能输入的下拉框
<span>
<input name="Department1" id="Department1" style=" border-right:0;width:130" autocomplete="off">
<span style="width:150;overflow:hidden">
<select  style="width:150;margin-left:-130" onChange="Department1.value=value">
<option value=""></option>
<option value="asdfasfadf">asdfasfadf</option>
<option value="546546">546546</option></select> //

74.图片加载失败时重新加载图片
<img src="aa.gif" οnerrοr="this.src='aa.gif'">//

1、建立一个htm文件,如:hotad.htm 放到贵站根目录
2、到热点后台取得新代码,并将新代码放到hotad.htm文件里
3、建立一个JS文件 如:ad01.js 放到贵站根目录
4、插入以下代码到 ad01.js

//以下是ad01.js的代码
document.write('')
document.write('  ')
//下面这行就是放置广告代码的页面,请注意 width="468" height="60" 是嵌入页面的宽度和高度
document.write('  ')
document.write('
')
document.write('  ')
//JS代码结束

说明:以上代码需要修改以下2个部分:
(1) width="468" height="60" 这2个数值根据广告位模式更改
(2) http://www.abc.com/ 换成贵站网址

5、在欲投放广告的地方插入JS。
  比如在某网页中插入:


全站使用这样的方式投放广告,那么无论更换广告代码是多么的频繁,每次更换也只需要一分种。
用iframe调用的好处是不会因为广告的显示速度慢影响网站的显示速度。

======================================================================

event.clientX 返回最后一次点击鼠标X坐标值;
event.clientY 返回最后一次点击鼠标Y坐标值;
event.offsetX 返回当前鼠标悬停X坐标值
event.offsetY 返回当前鼠标悬停Y坐标值
document.write(document.lastModified) 网页最后一次更新时间
document.οndblclick=x 当双击鼠标产生事件
document.οnmοusedοwn=x 单击鼠标键产生事件
document.body.scrollTop; 返回和设置当前竖向滚动条的坐标值,须与函数配合,
document.body.scrollLeft; 返回和设置当前横向滚动务的坐标值,须与函数配合,
document.title document.title="message"; 当前窗口的标题栏文字
document.bgcolor document.bgcolor="颜色值"; 改变窗口背景颜色
document.Fgcolor document.Fgcolor="颜色值"; 改变正文颜色
document.linkcolor document.linkcolor="颜色值"; 改变超联接颜色
document.alinkcolor document.alinkcolor="颜色值"; 改变正点击联接的颜色
document.VlinkColor document.VlinkColor="颜色值"; 改变已访问联接的颜色
document.forms.length 返回当前页form表单数
document.anchors.length 返回当前页锚的数量
document.links.length 返回当前页联接的数量
document.οnmοusedοwn=x 单击鼠标触发事件
document.οndblclick=x 双击鼠标触发事件
defaultStatus window.status=defaultStatus; 将状态栏设置默认显示
function function xx(){...} 定义函数
isNumeric 判断是否是数字
innerHTML xx=对象.innerHTML 输入某对象标签中的html源代码
innerText divid.innerText=xx 将以div定位以id命名的对象值设为XX
location.reload(); 使本页刷新,target可等于一个刷新的网页
Math.random() 随机涵数,只能是0到1之间的数,如果要得到其它数,可以为*10,再取整
Math.floor(number) 将对象number转为整数,舍取所有小数
Math.min(1,2) 返回1,2哪个小
Math.max(1,2) 返回1,2哪个大
navigator.appName 返回当前浏览器名称
navigator.appVersion 返回当前浏览器版本号
navigator.appCodeName 返回当前浏览器代码名字
navigator.userAgent 返回当前浏览器用户代标志
*****ubmit *****ubmit="return(xx())" 使用函数返回值
opener opener.document.对象 控制原打开窗体对象
prompt xx=window.prompt("提示信息","预定值"); 输入语句
parent parent.框架名.对象 控制框架页面
return return false 返回值
random 随机参数(0至1之间)
reset() form.reset(); 使form表单内的数据重置
split("") string.split("") 将string对象字符以逗号隔开
submit() form对象.submit() 使form对象提交数据
String对象的 charAt(x)对象 反回指定对象的第多少位的字母
lastIndexOf("string") 从右到左询找指定字符,没有返回-1
indexOf("string") 从左到右询找指定字符,没有返回-1
LowerCase() 将对象全部转为小写
UpperCase() 将对象全部转为大写
substring(0,5) string.substring(x,x) 返回对象中从0到5的字符
setTimeout("function",time) 设置一个超时对象
setInterval("function",time) 设置一个超时对象
toLocaleString() x.toLocaleString() 从x时间对象中获取时间,以字符串型式存在
typeof(变量名) 检查变量的类型,值有:String,Boolean,Object,Function,Underfined
window.event.button==1/2/3 鼠标键左键等于1右键等于2两个键一起按为3
window.screen.availWidth 返回当前屏幕宽度(空白空间)
window.screen.availHeight 返回当前屏幕高度(空白空间)
window.screen.width 返回当前屏幕宽度(分辨率值)
window.screen.height 返回当前屏幕高度(分辨率值)
window.document.body.offsetHeight; 返回当前网页高度
window.document.body.offsetWidth; 返回当前网页宽度
window.resizeTo(0,0) 将窗口设置宽高
window.moveTo(0,0) 将窗口移到某位置
window.focus() 使当前窗口获得焦点
window.scroll(x,y) 窗口滚动条坐标,y控制上下移动,须与函数配合
window.open() window.open("地址","名称","属性")
属性:toolbar(工具栏),location(地址栏),directi*****,status(状态栏),
menubar(菜单栏),scrollbar(滚动条),resizable(改变大小), width(宽),height(高),fullscreen(全 屏),scrollbars(全屏时无滚动条无参 数,channelmode(宽屏),left(打开窗口x坐标),top(打开窗口y坐标)
window.location = 'view-source:' + window.location.href 应用事件查看网页源代码;

a=new Date(); //创建a为一个新的时期对象
y=a.getYear(); //y的值为从对象a中获取年份值 两位数年份
y1=a.getFullYear(); //获取全年份数 四位数年份
m=a.getMonth(); //获取月份值
d=a.getDate(); //获取日期值
d1=a.getDay(); //获取当前星期值
h=a.getHours(); //获取当前小时数
m1=a.getMinutes(); //获取当前分钟数
s=a.getSeconds(); //获取当前秒钟数

对象.style.fontSize="文字大小";
单位:mm/cm/in英寸/pc帕/pt点/px象素/em文字高
1in=1.25cm
1pc=12pt
1pt=1.2px(800*600分辩率下)
文本字体属性:
fontSize大小
family字体
color颜色
fontStyle风格,取值为normal一般,italic斜体,oblique斜体且加粗
fontWeight加粗,取值为100到900不等,900最粗,light,normal,bold
letterSpacing间距,更改文字间距离,取值为,1pt,10px,1cm
textDecoration:文字修饰;取值,none不修饰,underline下划线,overline上划线
background:文字背景颜色,
backgroundImage:背景图片,取值为图片的插入路径

点击网页正文函数调用触发器:
1.onClick 当对象被点击
2.onLoad 当网页打开,只能书写在body中
3.onUnload 当网页关闭或离开时,只能书写在body中
4.onmouseover 当鼠标悬于其上时
5.onmouseout 当鼠标离开对象时
6.onmouseup 当鼠标松开
7.onmousedown 当鼠标按下键
8.onFocus 当对象获取焦点时
9.*****elect 当对象的文本被选中时
10.onChange 当对象的内容被改变
11.onBlur 当对象失去焦点
*****ubmit=return(ss())表单调用时返回的值
直线 border-bottom:1x solid black
虚线 border-bottom:1x dotted black
点划线 border-bottom:2x dashed black
双线 border-bottom:5x double black
槽状 border-bottom:1x groove black
脊状 border-bottom:1x ridge black

1.边缘高光glow(color=颜色,strength=亮光大小)

2.水平翻转fliph() 使对象水平翻转180度

3.垂直翻转flipv() 使对象垂直翻转180度

4.对象模糊blur(add=true/false direction=方向 strength=强度)
add指定是否按印象画派进行模糊direction模糊方向strength模糊强度
5.对象透明alpha(opaction=0-100,finishopacity=0-100,style=0/1/2/3)
opaction对象整体不透明值finishopacity当对象利用了渐透明时该项指定结束透明位置的不透明值style指定透明方式0为整体透明,1为线型透明,2为圆型透明,3为矩形透明
6.去除颜色chroma(color=颜色值)使对象中颜色与指定颜色相同区域透明
7.建立阴影dropshadow(color=阴影颜色,offx=水平向左偏离像素,offy=水平向下偏离像素)
8.去色gray()使对象呈灰度显示
9.负片效果invert()使对象呈底片效果
10.高光light()使对象呈黑色显示
11.遮盖mask(color=颜色)使整个对象以指定颜色进行蒙板一次
opacity 表透明度水平.0~100,0表全透明,100表完全不透明
finishopacity表想要设置的渐变透明效果.0~100.
style 表透明区的形状.0表统一形状.1表线形.2表放射形.3表长方形.
startx.starty表渐变透明效果的开始时X和Y坐标.
finishx,finishy渐变透明效果结束时x,y 的坐标.
add有来确定是否在模糊效果中使有原有目标.值为0,1.0表"否",1表"是".
direction设置模糊的方向.0度表垂直向上,45度为一个单位.默认值是向左270度.left,right,down,up.
strength 只能用整数来确定.代表有多少个像素的宽度将受到模糊影响.默认是5个.
color要透明的颜色.
offx,offy分别是x,y 方向阴影的偏移量.
positive指投影方式.0表透明像素生成阴影.1表只给出不透明像素生成阴影..
AddAmbient:加入包围的光源.
AddCone:加入锥形光源.
AddPoint加入点光源
Changcolor:改变光的颜色.
Changstrength:改变光源的强度.
Clear:清除所有的光源.
MoveLight:移动光源.
freq是波纹的频率,在指定在对象上一区需要产生多少个完事的波纹.
lightstrength可对于波纹增强光影的效果.显著0~100正整数,正弦波开始位置是0~360度.0表从0度开始,25表从90度开始.
strength表振幅大小.

hand style="cursor:hand"
crosshair style="cursor:crosshair"
text style="cursor:text"
wait style="cursor:wait"
default style="cursor:default"
help style="cursor:help"
e-resize style="cursor:e-resize"
ne-resize style="cursor:ne-resize"
n-resize style="cursor:n-resize"
nw-resize style="cursor:nw-resize"
w-resize style="cursor:w-resize"
s-resize style="cursor:s-resize"
sw-resize style="cursor:sw-resize "
se-resize style="cursor:se-resize"
auto style="cursor:auto"

下载13个经典JS广告代码
[URL=event.clientX 返回最后一次点击鼠标X坐标值;
event.clientY 返回最后一次点击鼠标Y坐标值;
event.offsetX 返回当前鼠标悬停X坐标值
event.offsetY 返回当前鼠标悬停Y坐标值
document.write(document.lastModified) 网页最后一次更新时间
document.οndblclick=x 当双击鼠标产生事件
document.οnmοusedοwn=x 单击鼠标键产生事件
document.body.scrollTop; 返回和设置当前竖向滚动条的坐标值,须与函数配合,
document.body.scrollLeft; 返回和设置当前横向滚动务的坐标值,须与函数配合,
document.title document.title="message"; 当前窗口的标题栏文字
document.bgcolor document.bgcolor="颜色值"; 改变窗口背景颜色
document.Fgcolor document.Fgcolor="颜色值"; 改变正文颜色
document.linkcolor document.linkcolor="颜色值"; 改变超联接颜色
document.alinkcolor document.alinkcolor="颜色值"; 改变正点击联接的颜色
document.VlinkColor document.VlinkColor="颜色值"; 改变已访问联接的颜色
document.forms.length 返回当前页form表单数
document.anchors.length 返回当前页锚的数量
document.links.length 返回当前页联接的数量
document.οnmοusedοwn=x 单击鼠标触发事件
document.οndblclick=x 双击鼠标触发事件
defaultStatus window.status=defaultStatus; 将状态栏设置默认显示
function function xx(){...} 定义函数
isNumeric 判断是否是数字
innerHTML xx=对象.innerHTML 输入某对象标签中的html源代码
innerText divid.innerText=xx 将以div定位以id命名的对象值设为XX
location.reload(); 使本页刷新,target可等于一个刷新的网页
Math.random() 随机涵数,只能是0到1之间的数,如果要得到其它数,可以为*10,再取整
Math.floor(number) 将对象number转为整数,舍取所有小数
Math.min(1,2) 返回1,2哪个小
Math.max(1,2) 返回1,2哪个大
navigator.appName 返回当前浏览器名称
navigator.appVersion 返回当前浏览器版本号
navigator.appCodeName 返回当前浏览器代码名字
navigator.userAgent 返回当前浏览器用户代标志
*****ubmit *****ubmit="return(xx())" 使用函数返回值
opener opener.document.对象 控制原打开窗体对象
prompt xx=window.prompt("提示信息","预定值"); 输入语句
parent parent.框架名.对象 控制框架页面
return return false 返回值
random 随机参数(0至1之间)
reset() form.reset(); 使form表单内的数据重置
split("") string.split("") 将string对象字符以逗号隔开
submit() form对象.submit() 使form对象提交数据
String对象的 charAt(x)对象 反回指定对象的第多少位的字母
lastIndexOf("string") 从右到左询找指定字符,没有返回-1
indexOf("string") 从左到右询找指定字符,没有返回-1
LowerCase() 将对象全部转为小写
UpperCase() 将对象全部转为大写
substring(0,5) string.substring(x,x) 返回对象中从0到5的字符
setTimeout("function",time) 设置一个超时对象
setInterval("function",time) 设置一个超时对象
toLocaleString() x.toLocaleString() 从x时间对象中获取时间,以字符串型式存在
typeof(变量名) 检查变量的类型,值有:String,Boolean,Object,Function,Underfined
window.event.button==1/2/3 鼠标键左键等于1右键等于2两个键一起按为3
window.screen.availWidth 返回当前屏幕宽度(空白空间)
window.screen.availHeight 返回当前屏幕高度(空白空间)
window.screen.width 返回当前屏幕宽度(分辨率值)
window.screen.height 返回当前屏幕高度(分辨率值)
window.document.body.offsetHeight; 返回当前网页高度
window.document.body.offsetWidth; 返回当前网页宽度
window.resizeTo(0,0) 将窗口设置宽高
window.moveTo(0,0) 将窗口移到某位置
window.focus() 使当前窗口获得焦点
window.scroll(x,y) 窗口滚动条坐标,y控制上下移动,须与函数配合
window.open() window.open("地址","名称","属性")
属性:toolbar(工具栏),location(地址栏),directi*****,status(状态栏),
menubar(菜单栏),scrollbar(滚动条),resizable(改变大小), width(宽),height(高),fullscreen(全 屏),scrollbars(全屏时无滚动条无参 数,channelmode(宽屏),left(打开窗口x坐标),top(打开窗口y坐标)
window.location = 'view-source:' + window.location.href 应用事件查看网页源代码;

a=new Date(); //创建a为一个新的时期对象
y=a.getYear(); //y的值为从对象a中获取年份值 两位数年份
y1=a.getFullYear(); //获取全年份数 四位数年份
m=a.getMonth(); //获取月份值
d=a.getDate(); //获取日期值
d1=a.getDay(); //获取当前星期值
h=a.getHours(); //获取当前小时数
m1=a.getMinutes(); //获取当前分钟数
s=a.getSeconds(); //获取当前秒钟数

对象.style.fontSize="文字大小";
单位:mm/cm/in英寸/pc帕/pt点/px象素/em文字高
1in=1.25cm
1pc=12pt
1pt=1.2px(800*600分辩率下)
文本字体属性:
fontSize大小
family字体
color颜色
fontStyle风格,取值为normal一般,italic斜体,oblique斜体且加粗
fontWeight加粗,取值为100到900不等,900最粗,light,normal,bold
letterSpacing间距,更改文字间距离,取值为,1pt,10px,1cm
textDecoration:文字修饰;取值,none不修饰,underline下划线,overline上划线
background:文字背景颜色,
backgroundImage:背景图片,取值为图片的插入路径

点击网页正文函数调用触发器:
1.onClick 当对象被点击
2.onLoad 当网页打开,只能书写在body中
3.onUnload 当网页关闭或离开时,只能书写在body中
4.onmouseover 当鼠标悬于其上时
5.onmouseout 当鼠标离开对象时
6.onmouseup 当鼠标松开
7.onmousedown 当鼠标按下键
8.onFocus 当对象获取焦点时
9.*****elect 当对象的文本被选中时
10.onChange 当对象的内容被改变
11.onBlur 当对象失去焦点
*****ubmit=return(ss())表单调用时返回的值
直线 border-bottom:1x solid black
虚线 border-bottom:1x dotted black
点划线 border-bottom:2x dashed black
双线 border-bottom:5x double black
槽状 border-bottom:1x groove black
脊状 border-bottom:1x ridge black

1.边缘高光glow(color=颜色,strength=亮光大小)

2.水平翻转fliph() 使对象水平翻转180度

3.垂直翻转flipv() 使对象垂直翻转180度

4.对象模糊blur(add=true/false direction=方向 strength=强度)
add指定是否按印象画派进行模糊direction模糊方向strength模糊强度
5.对象透明alpha(opaction=0-100,finishopacity=0-100,style=0/1/2/3)
opaction对象整体不透明值finishopacity当对象利用了渐透明时该项指定结束透明位置的不透明值style指定透明方式0为整体透明,1为线型透明,2为圆型透明,3为矩形透明
6.去除颜色chroma(color=颜色值)使对象中颜色与指定颜色相同区域透明
7.建立阴影dropshadow(color=阴影颜色,offx=水平向左偏离像素,offy=水平向下偏离像素)
8.去色gray()使对象呈灰度显示
9.负片效果invert()使对象呈底片效果
10.高光light()使对象呈黑色显示
11.遮盖mask(color=颜色)使整个对象以指定颜色进行蒙板一次
opacity 表透明度水平.0~100,0表全透明,100表完全不透明
finishopacity表想要设置的渐变透明效果.0~100.
style 表透明区的形状.0表统一形状.1表线形.2表放射形.3表长方形.
startx.starty表渐变透明效果的开始时X和Y坐标.
finishx,finishy渐变透明效果结束时x,y 的坐标.
add有来确定是否在模糊效果中使有原有目标.值为0,1.0表"否",1表"是".
direction设置模糊的方向.0度表垂直向上,45度为一个单位.默认值是向左270度.left,right,down,up.
strength 只能用整数来确定.代表有多少个像素的宽度将受到模糊影响.默认是5个.
color要透明的颜色.
offx,offy分别是x,y 方向阴影的偏移量.
positive指投影方式.0表透明像素生成阴影.1表只给出不透明像素生成阴影..
AddAmbient:加入包围的光源.
AddCone:加入锥形光源.
AddPoint加入点光源
Changcolor:改变光的颜色.
Changstrength:改变光源的强度.
Clear:清除所有的光源.
MoveLight:移动光源.
freq是波纹的频率,在指定在对象上一区需要产生多少个完事的波纹.
lightstrength可对于波纹增强光影的效果.显著0~100正整数,正弦波开始位置是0~360度.0表从0度开始,25表从90度开始.
strength表振幅大小.

hand style="cursor:hand"
crosshair style="cursor:crosshair"
text style="cursor:text"
wait style="cursor:wait"
default style="cursor:default"
help style="cursor:help"
e-resize style="cursor:e-resize"
ne-resize style="cursor:ne-resize"
n-resize style="cursor:n-resize"
nw-resize style="cursor:nw-resize"
w-resize style="cursor:w-resize"
s-resize style="cursor:s-resize"
sw-resize style="cursor:sw-resize "
se-resize style="cursor:se-resize"
auto style="cursor:auto"
--------------

1.取消按钮按下时的虚线框   
  在input里添加属性值 hideFocus 或者 HideFocus=true   
 
2.只读文本框内容   
在input里添加属性值 readonly   
 
3.防止退后清空的TEXT文档(可把style内容做做为类引用)   
  <INPUT style=behavior:url(#default#savehistory); type=text id=oPersistInput>   
 
4.ENTER键可以让光标移到下一个输入框   
  <input οnkeydοwn="if(event.keyCode==13)event.keyCode=9" >   
 
5.只能为中文(有闪动)   
  <input οnkeyup="value=value.replace(/[ -~]/g,'')" οnkeydοwn="if(event.keyCode==13)event.keyCode=9">   
 
6.只能为数字(有闪动)   
  <input οnkeyup="value=value.replace(/[^/d]/g,'') "onbeforepaste= "clipboardData.setData(’text’,clipboardData.getData(’text’).replace(/[^/d]/g,’’))">   
 
7.只能为数字(无闪动)   
  <input style="ime-mode:disabled" οnkeydοwn="if(event.keyCode==13) event.keyCode=9" onKeyPress="if ((event.keyCode<48 || event.keyCode>57)) event.returnValue=false">   
 
8.只能输入英文和数字(有闪动)   
  <input οnkeyup="value=value.replace(/[/W]/g,’’)" onbeforepaste= "clipboardData.setData(’text’,clipboardData.getData(’text’).replace(/[^/d]/g,’’))">   
 
9.屏蔽输入法   
  <input type="text" name="url" style="ime-mode:disabled" οnkeydοwn="if(event.keyCode==13)event.keyCode=9">   
 
10. 只能输入 数字,小数点,减号(-) 字符(无闪动)   
  <input onKeyPress="if (event.keyCode!=46 && event.keyCode!= 45 && (event.keyCode<48 || event.keyCode>57)) event.returnValue=false">   
 
11. 只能输入两位小数,三位小数(有闪动)   
  <input maxlength=9 οnkeyup="if(value.match(/^/d{3}$/))value= value.replace(value,parseInt(value/10)) ;value=value.replace(//./d*/./g,’.’)" onKeyPress="if((event.keyCode<48 || event.keyCode>57) && event.keyCode!=46 && event.keyCode!=45 || value.match(/^/d{3}$/) || //./d{3}$/.test(value)) {event.returnValue=false}" id=text_kfxe name=text_kfxe>   
 
 
------------------------------------------------------------------------   
<input type="text" name="input1" value="中国">   
 
怎样使input中的内容为只读,也就是说不让用户更改里面的内容。   
<input type="text" name="input1" value="中国" οnfοcus=this.blur()>   
<input type="text" name="input1" value="中国" readonly>   
<input type="text" name="input1" value="中国" disabled>   
最好不要用disabled,不然就无法取出里面的值了.   
<input type="text" name="input1" value="中国" readonly="true">   
<input type="text" name="input1" value="中国" readonly style="color:#999 ;"> 

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值