Mhhover (' Start ID name ', ' X td tag ', ' Style name ')
Program code
function Mhhover (TBL,IDX,CLS) {
var t,d;
if (document.getElementById) T=document.getelementbyid (TBL);
else T=document.all (TBL);
if (t==null) return;
if (t.getelementsbytagname) d=t.getelementsbytagname ("TD");
else D=t.all.tags ("TD");
if (d==null) return;
if (D.LENGTH<=IDX)
Return
D[idx].classname=cls;
}
Drop down menu, show hidden ID
How to use
Onchange= "Optionnumber_change (' form name ', ' ID name same part (sequence number automatic value) ')"
Note: The value of the form must be a number
Program code
function Optionnumber_change (selobj,stropt)
{
var a = (Selobj.options[selobj.selectedindex].value);
for (i = 1; i <= A; i++)
{
document.getElementById (stropt+i). Style.display = "";
}
for (j = j > A; j--)
{
document.getElementById (stropt+j). Style.display = "None";
}
}
Read the database, show hidden IDs
How to use
//
Program code
function Listnumber_change (LISTOBJ,LISTSTR)
{
var a = Listobj;
for (i = 1; i <= A; i++)
{
document.getElementById (liststr+i). Style.display = "";
}
for (j = j > A; j--)
{
document.getElementById (liststr+j). Style.display = "None";
}
}
Self-adaptive height of IFRAME
How to use:
Onload= "Resizeframe (' iframe ID name ')"
Program code
function Resizeframe (Frameid) {//frameid is your ifream name.
try {
var obody = eval (frameid+ ". Document.body");
var oframe = document.all (Frameid);
OFrame.style.height = Obody.scrollheight + (obody.offsetheight-obody.clientheight);
}
catch (e) {
Window.status = ' Error: ' + E.number + '; ' + e.description;
}
}
Select all check boxes
How to use:
Onclick=checkall (this.form,this.checked)
Program code
function Checkall (form1,v) {
for (Var i=0;i<form1.elements.length;i++) {
var e = form1.elements[i];
if (e.type== ' checkbox ') e.checked = v;
}
}
Verifying the correctness of form string expressions
Program code
function Regexpcheck (re,geto,msg)
{
if (Re.test (geto.value) ==false)
{
if (geto.msg)
{
msg = Geto.msg+msg
}
Alert (msg)
Geto.focus ();
return false;
}
return true;
}
function Checkphone (Geto)
{
Re=/^ ([\d]) {2,5}-([\d]) {3,14}/gi
msg = "Phone format error \r\n\r\n Area number and telephone number in the middle please use"-"lattice open, for example: 029-82303721"
Return Regexpcheck (RE,GETO,MSG)
}
Verify your phone number
Program code
function Checkmobile (Geto)
{
Re=/^ (\+?[ 0-9]{0,3}13[0-9]{9}) $/gi
msg = "Phone format error"
Return Regexpcheck (RE,GETO,MSG)
}
Verifying the Checksum code
Program code
function Checkvcode (Geto)
{
Re=/^ (\d{4}) $/gi
msg = "Bad Check code format"
Return Regexpcheck (RE,GETO,MSG)
}
Verify Number 1
function CheckNumber (Geto)
{
Re=/^\d+$/gi
msg = "Wrong format, please enter 0~9 number"
Return Regexpcheck (RE,GETO,MSG)
}
Verify Number 2
function Checknumbertext (GET0,MSG0)
{
Re =/^\d+$/gi
msg = Msg0
Return Regexpcheck (RE,GET0,MSG0)
}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.