本 站 搜 索 |
分 类 列 表 |
文 章 阅 读 排 行 |
|
 |
JavaScript 判断表单输入内容 一 |
|
4475 |
2006-02-07 |
//函数名:chksafe//功能介绍:检查是否含有"'",'\\',"/"//参数说明:要检查的字符串//返回值:0:是 1:不是
function chksafe(a){ return 1;/* fibdn = new Array ("'" ,"\\", "、", ",", ";", "/");i=fibdn.length;j=a.length;for (ii=0;iii;ii++){ for (jj=0;jjj;jj++) { temp1=a.charAt(jj); temp2=fi.. |
|
 |
JavaScript 判断表单输入内容 二 |
|
5267 |
2006-02-07 |
html head metahttp-equiv="Content-Type"content="text/html;charset=gb2312" titleJavaScript/title scriptlanguage="javascript" 去掉空格 functionTrim(str){ if(str.charAt(0)==""){ str=str.slice(1); str=Trim(str); } returnstr; } 判断是否是空 functionisEmpty(pObj,errMsg){ varobj=eval(p.. |
|
 |
JavaScript 弹出窗口代码 二 |
|
4016 |
2006-02-07 |
1、最简单的弹出窗口代码
SCRIPT LANGUAGE="javascript" !-- window.open ('page.html') -- /SCRIPT 因为着是一段javascripts代码,所以它们应该放在SCRIPT LANGUAGE="javascript"标签和/script之间。!-- 和 --是对一些版本低的浏览器起作用,在这些老浏览器中不会将标签中的代码作为文本显示出来。.. |
|
 |
禁止在网页上使用左键(右键)选择(复制)网页内容(图片) |
|
3365 |
2006-03-17 |
在网页的 body 里面加入以下代码:
oncontextmenu="return false"ondragstart="return false"onselectstart ="return false"onselect="document.selection.empty()"oncopy="document.selection.empty()"onbeforecopy="return false"onmouseup="document.selection.empty()"
注:每段代码之间要有空格.. |
|
 |
虚拟抽奖程序 |
|
1894 |
2006-09-14 |
script language="JavaScript"function lotto(){if (!document.all!document.layers)returnfor (j=1; j 48; j++)//stop zero!?{var a=Math.round(Math.random()*j+1);var b=Math.round(Math.random()*j+1);var c=Math.round(Math.random()*j+1);var d=Math.round(Math.random()*j+1);var e=Math.roun.. |
|
 |
文本框字数输入限制 |
|
1748 |
2007-06-06 |
Script Language="JavaScript"!--maxLen=10;function checkMaxInput(form) {if (form.message.value.length maxLen)form.message.value = form.message.value.substring(0, maxLen);else form.remLen.value = maxLen - form.message.value.length;}//--/script
form name="myform" action="1.asp"
.. |
|
 |
文本框内容的复制/粘贴/清空代码 |
|
2366 |
2007-06-06 |
FORM name=CodeTest
TEXTAREA name=WenBei rows=6 cols=50/TEXTAREABRBR
INPUT onclick="CodeTest.WenBei.select();document.execCommand('Copy');" type=button value=复制文本INPUT onclick="CodeTest.WenBei.focus();document.execCommand('Paste');" type=button value=粘贴文本INPUT onclick=".. |
|
 |
检测表单提交时的提示信息 |
|
1778 |
2007-06-06 |
Script Language="JavaScript"!--function CheckForm() {if (document.SendMail.M_Email.value=="") {//SendMail.M_Email.value="必须填写收信人邮箱地址...";//alert("必须填写收信人邮箱地址...");//EM_M_Email.innerText="font color=#FF0000必须填写收信人邮箱地址/font"EM_M_Email.innerHTML="fo.. |
|
 |
显示表单中已输入的字数 |
|
2659 |
2007-06-06 |
textarea name="t" rows="5" cols="50" onpropertychange="c.value = value.match(/[^ -~]/g) == null ? value.length : value.length + value.match(/[^ -~]/g).length"/textareabr已输入字数:input name="c" |
|
 |
表单提交后按钮即失效 |
|
1886 |
2007-07-09 |
Script Language="JavasSript" !--function checkform() {test.submit.disabled=true;}//--/Scriptform action="1.asp" name="test" onsubmit="return checkform();"input type="submit" name="submit"/form
form action="0.asp" onsubmit="this.sub.disabled=true;" input type="submit" name="sub".. |
|
 |
一个表单两个提交按钮 |
|
1706 |
2007-07-09 |
Script Language="JavaScript"!--function submitit1() {document.myForm.action="cgi1.php"document.myForm.submit();}
function submitit2() {document.myForm.action="cgi2.php"document.myForm.submit();}//-/Script
form name="myForm" METHOD="post"username:input type=text name=text1pass.. |
|
 |
仿 Google 输入表单的提示可选择的文字 |
|
2881 |
2007-07-09 |
meta http-equiv="Content-Type" content="text/html; charset=utf-8" /script
function suckerfish(type, tag, parentId){if (window.attachEvent){window.attachEvent("onload", function(){var sfEls = (parentId==null)?
document.getElementsByTagName(tag):document.getElementById(parentId).. |
|
|