這些function 是從網路收集來的,出處己經忘記
//=============檢驗Mail強制為a-z&0-9的數字==========
function ValidateFieldMail(objMail)
{
var email = objMail.value;
var rege = /^([a-zA-Z0-9])+([a-zA-Z0-9])+([a-zA-Z0-9])+([a-zA-Z0-9])+([a-zA-Z0-9])+([a-zA-Z0-9])/;
if (email.length == 0 || rege.exec(email) == null)
{
objMail.value ="";
alert("請參照密碼規則");
//return false;
}
objMail.value = objMail.value.toString().toUpperCase() ;
//return true;
}
//================檢查是否為數字==================
function IsNumeric(sText){
var ValidChars = "0123456789.";
var IsNumber=true;
var Char;
for (i = 0; i < sText.length && IsNumber == true; i++)
{
Char = sText.charAt(i);
if (ValidChars.indexOf(Char) == -1)
{
IsNumber = false;
}
}
return IsNumber;
}
//=============彈跳視窗置中=====================
function NewWindow(mypage, myname, w, h, scroll) {
// resizable 是否許可設定視窗尺寸 yes 或 no
// toolbar 是否展示工具列 yes 或 no
// status 是否顯示狀態列 yes 或 no
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+', scrollbars='+scroll+',resizable=yes,toolbar=no, status=no';
win = window.open(mypage, myname, winprops);
if ( parseInt(navigator.appVersion) >= 4){
win.window.focus();
}
}
//=============另一個彈跳視窗======================
function Open_Window(loc, form, id , name) {
var loc;
loc = loc+"?form="+form+"&form_id="+id+"&form_name="+name;
self.win_child=window.open(loc,"getcode","directories=no,location=no,menubar=no,toolbar=no,scrollbars=yes,height=600,width=700");
self.win_child.rtn_id=id;
self.win_child.rtn_name=name;
self.win_child.win_parent=self;
}
//===============強制為單選=======================
function ChooseOne(cb){
//先取得同name的chekcBox的集合物件
var obj = document.getElementsByName("pac_ite_no");
for (i=0; i<obj.length; i++){
//判斷obj集合中的i元素是否為cb,若否則表示未被點選
if (obj!=cb) obj.checked = false;
//若是 但原先未被勾選 則變成勾選;反之 則變為未勾選
else obj.checked = cb.checked;
//若要至少勾選一個的話,則把上面那行else拿掉,換用下面那行
//else obj.checked = true;
}
}
沒有留言:
張貼留言