// get the Browser type function getBrowserType() ...{ var OsObject =""; if (navigator.userAgent.indexOf("MSIE") >0) ...{ return"IE"; } if (isFirefox = navigator.userAgent.indexOf("Firefox") >0) ...{ return"Firefox"; } if (isSafari = navigator.userAgent.indexOf("Safari") >0) ...{ return"Safari"; } if (isCamino = navigator.userAgent.indexOf("Camino") >0) ...{ return"Camino"; } if (isMozilla = navigator.userAgent.indexOf("Gecko/") >0) ...{ return"Gecko"; } } // Get the value of element function valueOf(element) ...{ if (typeof element =="string") ...{ element = get(element); } if (element) ...{ return element.value; } returnnull; } // the value of the element is Email format or not function isEmail(element, alertMsg) ...{ strEmail = element.value; if (0== strEmail.length) ...{ returntrue; } if (strEmail.search(/^w+((-w+)|(.w+))*@[A-Za-z0-9]+((.|-)[A-Za-z0-9]+)*.[A-Za-z0-9]+$/) !=-1) ...{ returntrue; } if (alertMsg !=null) ...{ error(element, alertMsg); } returnfalse; } // initialize the select, set the option, which value equals argument ,is selected function initSelect(selectId, optionValue) ...{ var aSelect = get(selectId); if (aSelect ==null) ...{ return; } var options = aSelect.options; for (var i =0; i < options.length; i++) ...{ if (options[i].value == optionValue) ...{ options[i].selected =true; break; } } if (aSelect.onchange) ...{ aSelect.onchange(); } } // initialize the checkbox, set the checkbox is checked or not, // value : true or false function initCheckbox(checkbox, value) ...{ var element = get(checkbox); if (!element) ...{ return; } if (value) ...{ element.checked =true; }else...{ element.checked =false; } if (element.onclick) ...{ element.onclick(); } }