// 获取浏览器版本 function getos( key, count ) { tmpstr = $.trim(navigator.useragent.tolowercase()); key = $.trim(key.tolowercase()); if ( tmpstr.indexof(key) > -1 ) { return tmpstr.substr( tmpstr.indexof(key) + key.length + 1, count ); } else { return false; } } // 初始化浏览器版本 var ie, firefox, opera; ie = getos( "msie", 3 ); firefox = getos( "firefox", 8 ); opera = getos( "opera", 4 ); function sprintf() { var arg = arguments, str = arg[0] || '', i, n; for (i = 1, n = arg.length; i < n; i++) { str = str.replace(/%s/, arg[i]); } return str; } function checkticketsearch() { if ($('#origin').val() == '') { alert('始发地不能为空'); $('#origin').focus(); $('#origin').select(); return false; } if ($('#destination').val() == '') { alert('目的地不能为空'); $('#destination').focus(); $('#destination').select(); return false; } if ($('#pubdate').val() == '') { alert('日期不能为空'); $('#pubdate').focus(); $('#pubdate').select(); return false; } return true; }