一些js例子

类别:Asp 点击:0 评论:0 推荐:
function __doPostBack(eventTarget, eventArgument) { var theform; theform = document.Form1; if(eval("document.Form1.__EVENTTARGET") == null) { var o1 = document.createElement("input"); o1.type="hidden"; o1.name ="__EVENTTARGET"; o1.id= "__EVENTTARGET"; theform.appendChild(o1); } if(eval("document.Form1.__EVENTARGUMENT")== null) { var o2 = document.createElement("input"); o2.type="hidden"; o2.name ="__EVENTARGUMENT"; o2.id ="__EVENTARGUMENT"; theform.appendChild(o2); } theform.__EVENTTARGET.value = eventTarget; theform.__EVENTARGUMENT.value = eventArgument; theform.submit(); }

function SaveText() { //取得id=tb的表格的HTML代码. var strHTML = tb.outerHTML; var winSave = window.open(); winSave.document.open ("text/html","gb2312"); winSave.document.write (strHTML); winSave.document.execCommand ("SaveAs",true,"table.htm"); winSave.close(); }

function IsNumericStringByReg(s) { //var re=new RegExp("^[123456789]\\d*\\d$"); //var re=/^[123456789]\d*\d$/; var re=/^(-?\d+)(\.\d+)?$/; if (re.test(s)) return true; return false; }

function IsNumericStringByReg1(s) { var path=/^(-?\d+)(\.\d+)?$/; if(!regMatch(s,path)) window.alert("请输入浮点数") return true; }

本文地址:http://com.8s8s.com/it/it8537.htm