JavaScript判断各种浏览器
function getOs(){
var OsObject = "";
if(navigator.userAgent.indexOf("MSIE")>0) {
return "MSIE";
}
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";
}
}
相关文档:
Siebel支持在浏览器的地址栏使用javascript
例如
javascript:alert(theApplication().GetProfielAttr("Employee Flag");
javascript:var sBo = theApplication().ActiveBusObject();sBc = sBo.GetBusComp("Contact");alert(sBc.GetFieldValue("Last Name")); ......
javaScript 截取字符串
两种方法:
String.substr(N1,N2) 这个就是我们常用的从指定的位置(N1)截取指定长度(N2)的字符串;
String.substring(N1,N2) 这个就是我们常用的从指定的位置(N1)到指定的位置(N2)的字符串;
例如
对于http://localhost:8008index.aspx
substr(22,5)=substring(22,27)
Result:index
打印本页
......
在上面的示例中,我们定义了两个语法甘露,一个是Class()函数,一个是New()函数。使用Class()甘露,我们已经可以用非常优雅的格式定义一个类。例如前例中的:
var
Employee
=
Class(Person,
//
派生至Person类
{
......
1.document.write(""); 输出语句
2.JS中的注释为//
3.传统的HTML文档顺序是:document->html->(head,body)
4.一个浏览器窗口中的DOM顺序是:window->(navigator,screen,history,location,document)
5.得到表单中元素的名称和值:document.getElementById("表单中元素的ID号").name(或value)
6.一个小写转大 ......