navigator.appname(IX—Navigator官网)

大家好,感谢邀请,今天来为大家分享一下navigator.appname的问题,以及和IX—Navigator官网的一些困惑,大家要是还不太明白的话,也没有关系,因为接下来将为大家分享,希望可以帮助到大家,解决大家的问题,下面就开始吧!

在网页开发中,我们经常会用到一些浏览器内置的对象来获取浏览器信息,以便于我们更好地开发适应各种浏览器的网页。其中,navigator.appname就是一个非常实用的属性。本文将深入解析navigator.appname,帮助大家更好地了解和使用它。

一、navigator.appname简介

navigator.appname是浏览器内置对象navigator的一个属性,用于获取浏览器的名称。在大多数浏览器中,这个属性的值是”

请问在js里,window有多少种方法

window.location对象

window.location对象用于获得当前页面的地址(URL),并把浏览器重定向到新的页面。window.location对象在编写时可不使用 window这个前缀。

location.hostname返回 web主机的域名

location.pathname返回当前页面的路径和文件名

location.port返回 web主机的端口(80或 443)

location.protocol返回所使用的 web协议(http://或 https://)

window.location.href=””;跳转后有后退功能

window.location.replace(“”);跳转后没有后退功能

window.open(“”);在新的窗口打开链接,一般用于简单的弹出页面,现在基本上都被屏蔽掉 

window.location.reload();刷新当前页面.

parent.location.reload();刷新父亲对象(用于框架)

opener.location.reload();刷新父窗口对象(用于单开窗口)

top.location.reload();刷新最顶端对象(用于多开窗口)

window.history对象

window.history对象包含浏览器的历史。window.history对象在编写时可不使用 window这个前缀。

window.history.back()-加载历史列表中的前一个 URL,与在浏览器点击后退按钮相同,

window.history.forward()-加载历史列表中的下一个 URL。与在浏览器中点击按钮向前相同

window.navigator对象

window.navigator对象包含有关访问者浏览器的信息,来自 navigator对象的信息具有误导性,不应该被用于检测浏览器版本,这是因为:

navigator数据可被浏览器使用者更改

一些浏览器对测试站点会识别错误

浏览器无法报告晚于浏览器发布的新操作系统

window.navigator对象在编写时可不使用 window这个前缀。

window.navigator.appCodeName返回浏览器的代码名。

window.navigator.appName返回代表浏览器名的字符串。

window.navigator.appMinorVersion返回浏览器的次版本号。该属性是一个只读的字符串。仅IE有效。

window.navigator.userAgent返回代表浏览器名和版本号的字符串。

window.navigator.platform返回浏览器平台的字符串(”Win32″,”Win16″,”WinCE”,”Mac68k”,”MacPPC”,”HP-UX”,”SunOS”等)。

window.navigator.cpuClass返回CPU的信息(”x86″,”68K”,”Alpha”,”PPC”等)。仅IE有效。

window.navigator.browserLanguage返回浏览器的语言种类。仅IE有效。

window.navigator.systemLanguage返回系统的语言种类。仅IE有效。

window.navigator.userLanguage userLanguage返回用户环境的语言种类。仅IE有效。

window.navigator.cookieEnabled返回 cookie是否可用的真伪值。

window.navigator.onLine返回是否能连上网络的真伪值。

window.navigator.javaEnabled()返回 Java是否可用的真伪值。

window.navigator.userProfile保存着用户信息的对象。拥有 addReadRequest() doReadRequest() getAttribute() clearRequest()等方法。

window.navigator.taintEnabled()是否可以加密数据的真伪值。仅IE有效。

window对象的一些其它方法

setInterval()和 setTimeout()是 HTML DOM Window对象的两个方法。

window.setInterval()-间隔指定的毫秒数不停地执行指定的代码。

window.setTimeout()-暂停指定的毫秒数后执行指定的代码

window.clearInterval()方法用于停止 setInterval()方法执行的函数代码。

window.clearTimeout()方法用于停止执行setTimeout()方法的函数代码。

window.alert()-警告框经常用于确保用户可以得到某些信息。当警告框出现后,用户需要点击确定按钮才能继续进行操作。

window.prompt()-确认框用于使用户可以验证或者接受某些信息。当确认框出现后,用户需要点击确定或者取消按钮才能继续进行操作。如果用户点击确认,那么返回值为 true。如果用户点击取消,那么返回值为 false。

window.confirm()-提示框经常用于提示用户在进入页面前输入某个值。当提示框出现后,用户需要输入某个值,然后点击确认或取消按钮才能继续操纵。如果用户点击确认,那么返回值为输入的值。如果用户点击取消,那么返回值为 null。

window.open()-打开新窗口

window.close()-关闭当前窗口

window.moveTo()-移动当前窗口

window.resizeTo()-调整当前窗口的尺寸

window.frameElement获取当前文档的宿主节点iframe元素

window.execScript()execScript函数与eval的功能相同,不同的是eval函数执行后的脚本的作用域是当前执行上下文,而execScript则总是针对全局作用域。

求Java万年历源代码!!!

我有个JS的要么?

你可以把他改下我是没时间帮你该哈!!!

!–日期框选择–>>

var DS_x,DS_y;

function dateSelector()//构造dateSelector对象,用来实现一个日历形式的日期输入框。

{

var myDate=new Date();

this.year=myDate.getFullYear();//定义year属性,年份,默认值为当前系统年份。

this.month=myDate.getMonth()+1;//定义month属性,月份,默认值为当前系统月份。

this.date=myDate.getDate();//定义date属性,日,默认值为当前系统的日。

this.inputName='';//定义inputName属性,即输入框的name,默认值为空。注意:在同一页中出现多个日期输入框,不能有重复的name!

this.display=display;//定义display方法,用来显示日期输入框。

}

function display()//定义dateSelector的display方法,它将实现一个日历形式的日期选择框。

{

var week=new Array('日','一','二','三','四','五','六');

document.write(“<style type=text/css>”);

document.write(“.ds_font td,span{ font: normal 12px宋体; color:#000000;}”);

document.write(“.ds_border{ border: 1px solid#000000; cursor: hand; background-color:#DDDDDD}”);

document.write(“.ds_border2{ border: 1px solid#000000; cursor: hand; background-color:#DDDDDD}”);

document.write(“</style>”);

var M=new String(this.month);

var d=new String(this.date);

if(M.length==1&&d.length==1){

document.write(“<input style='text-align:center;' id='DS_”+this.inputName+”' name='”+this.inputName+”' value='”+this.year+”-0″+this.month+”-0″+this.date+”' title=双击可进行编缉 ondblclick='this.readOnly=false;this.focus()' onblur='this.readOnly=true' readonly>”);}

else if(M.length==1&&d.length==2){

document.write(“<input style='text-align:center;' id='DS_”+this.inputName+”' name='”+this.inputName+”' value='”+this.year+”-0″+this.month+”-“+this.date+”' title=双击可进行编缉 ondblclick='this.readOnly=false;this.focus()' onblur='this.readOnly=true' readonly>”);}

else if(M.length==2&&d.length==1){

document.write(“<input style='text-align:center;' id='DS_”+this.inputName+”' name='”+this.inputName+”' value='”+this.year+”-“+this.month+”-0″+this.date+”' title=双击可进行编缉 ondblclick='this.readOnly=false;this.focus()' onblur='this.readOnly=true' readonly>”);}

else if(M.length==2&&d.length==2){

document.write(“<input style='text-align:center;' id='DS_”+this.inputName+”' name='”+this.inputName+”' value='”+this.year+”-“+this.month+”-“+this.date+”' title=双击可进行编缉 ondblclick='this.readOnly=false;this.focus()' onblur='this.readOnly=true' readonly>”);}

document.write(“<button style='width:60px;height:18px;font-size:12px;margin:1px;border:1px solid#A4B3C8;background-color:#DFE7EF;' type=button onclick=this.nextSibling.style.display='block' onfocus=this.blur()>日期</button>”);

document.write(“<div style='position:absolute;display:none;text-align:center;width:0px;height:0px;overflow:visible' onselectstart='return false;'>”);

document.write(“<div style='position:absolute;left:-60px;top:20px;width:142px;height:165px;background-color:#F6F6F6;border:1px solid#245B7D;' class=ds_font>”);

document.write(“<table cellpadding=0 cellspacing=1 width=140 height=20 bgcolor=#CEDAE7 onmousedown='DS_x=event.x-parentNode.style.pixelLeft;DS_y=event.y-parentNode.style.pixelTop;setCapture();' onmouseup='releaseCapture();' onmousemove='dsMove(this.parentNode)' style='cursor:move;'>”);

document.write(“<tr align=center>”);

document.write(“<td width=12% onmouseover=this.className='ds_border' onmouseout=this.className='' onclick=subYear(this) title='减小年份'><<</td>”);

document.write(“<td width=12% onmouseover=this.className='ds_border' onmouseout=this.className='' onclick=subMonth(this) title='减小月份'><</td>”);

document.write(“<td width=52%><b>”+this.year+”</b><b>年</b><b>”+this.month+”</b><b>月</b></td>”);

document.write(“<td width=12% onmouseover=this.className='ds_border' onmouseout=this.className='' onclick=addMonth(this) title='增加月份'>></td>”);

document.write(“<td width=12% onmouseover=this.className='ds_border' onmouseout=this.className='' onclick=addYear(this) title='增加年份'>>></td>”);

document.write(“</tr>”);

document.write(“</table>”);

document.write(“<table cellpadding=0 cellspacing=0 width=140 height=20 onmousedown='DS_x=event.x-parentNode.style.pixelLeft;DS_y=event.y-parentNode.style.pixelTop;setCapture();' onmouseup='releaseCapture();' onmousemove='dsMove(this.parentNode)' style='cursor:move;'>”);

document.write(“<tr align=center>”);

for(i=0;i<7;i++)

document.write(“<td>”+week[i]+”</td>”);

document.write(“</tr>”);

document.write(“</table>”);

document.write(“<table cellpadding=0 cellspacing=2 width=140 bgcolor=#EEEEEE>”);

for(i=0;i<6;i++)

{

document.write(“<tr align=center>”);

for(j=0;j<7;j++)

document.write(“<td width=10% height=16 onmouseover=if(this.innerText!=''&&this.className!='ds_border2')this.className='ds_border' onmouseout=if(this.className!='ds_border2')this.className='' onclick=getValue(this,document.all('DS_”+this.inputName+”'))></td>”);

document.write(“</tr>”);

}

document.write(“</table>”);

document.write(“<span style=cursor:hand onclick=this.parentNode.parentNode.style.display='none'>【关闭】</span>”);

document.write(“</div>”);

document.write(“</div>”);

dateShow(document.all(“DS_”+this.inputName).nextSibling.nextSibling.childNodes[0].childNodes[2],this.year,this.month)

}

function subYear(obj)//减小年份

{

var myObj=obj.parentNode.parentNode.parentNode.cells[2].childNodes;

myObj[0].innerHTML=eval(myObj[0].innerHTML)-1;

dateShow(obj.parentNode.parentNode.parentNode.nextSibling.nextSibling,eval(myObj[0].innerHTML),eval(myObj[2].innerHTML))

}

function addYear(obj)//增加年份

{

var myObj=obj.parentNode.parentNode.parentNode.cells[2].childNodes;

myObj[0].innerHTML=eval(myObj[0].innerHTML)+1;

dateShow(obj.parentNode.parentNode.parentNode.nextSibling.nextSibling,eval(myObj[0].innerHTML),eval(myObj[2].innerHTML))

}

function subMonth(obj)//减小月份

{

var myObj=obj.parentNode.parentNode.parentNode.cells[2].childNodes;

var month=eval(myObj[2].innerHTML)-1;

if(month==0)

{

month=12;

subYear(obj);

}

myObj[2].innerHTML=month;

dateShow(obj.parentNode.parentNode.parentNode.nextSibling.nextSibling,eval(myObj[0].innerHTML),eval(myObj[2].innerHTML))

}

function addMonth(obj)//增加月份

{

var myObj=obj.parentNode.parentNode.parentNode.cells[2].childNodes;

var month=eval(myObj[2].innerHTML)+1;

if(month==13)

{

month=1;

addYear(obj);

}

myObj[2].innerHTML=month;

dateShow(obj.parentNode.parentNode.parentNode.nextSibling.nextSibling,eval(myObj[0].innerHTML),eval(myObj[2].innerHTML))

}

function dateShow(obj,year,month)//显示各月份的日

{

var myDate=new Date(year,month-1,1);

var today=new Date();

var day=myDate.getDay();

var selectDate=obj.parentNode.parentNode.previousSibling.previousSibling.value.split('-');

var length;

switch(month)

{

case 1:

case 3:

case 5:

case 7:

case 8:

case 10:

case 12:

length=31;

break;

case 4:

case 6:

case 9:

case 11:

length=30;

break;

case 2:

if((year%4==0)&&(year%100!=0)||(year%400==0))

length=29;

else

length=28;

}

for(i=0;i<obj.cells.length;i++)

{

obj.cells[i].innerHTML='';

obj.cells[i].style.color='';

obj.cells[i].className='';

}

for(i=0;i<length;i++)

{

obj.cells[i+day].innerHTML=(i+1);

if(year==today.getFullYear()&&(month-1)==today.getMonth()&&(i+1)==today.getDate())

obj.cells[i+day].style.color='red';

if(year==eval(selectDate[0])&&month==eval(selectDate[1])&&(i+1)==eval(selectDate[2]))

obj.cells[i+day].className='ds_border2';

}

}

function getValue(obj,inputObj)//把选择的日期传给输入框

{

var myObj=inputObj.nextSibling.nextSibling.childNodes[0].childNodes[0].cells[2].childNodes;

if(obj.innerHTML)

if(obj.innerHTML.length==1&&myObj[2].innerHTML.length==1)

inputObj.value=myObj[0].innerHTML+”-0″+myObj[2].innerHTML+”-0″+obj.innerHTML;

elseif(obj.innerHTML.length==1&&myObj[2].innerHTML.length==2)

inputObj.value=myObj[0].innerHTML+”-“+myObj[2].innerHTML+”-0″+obj.innerHTML;

elseif(obj.innerHTML.length==2&&myObj[2].innerHTML.length==1)

inputObj.value=myObj[0].innerHTML+”-0″+myObj[2].innerHTML+”-“+obj.innerHTML;

elseif(obj.innerHTML.length==2&&myObj[2].innerHTML.length==2)

inputObj.value=myObj[0].innerHTML+”-“+myObj[2].innerHTML+”-“+obj.innerHTML;

inputObj.nextSibling.nextSibling.style.display='none';

for(i=0;i<obj.parentNode.parentNode.parentNode.cells.length;i++)

obj.parentNode.parentNode.parentNode.cells[i].className='';

obj.className='ds_border2'

}

function dsMove(obj)//实现层的拖移

{

if(event.button==1)

{

var X=obj.clientLeft;

var Y=obj.clientTop;

obj.style.pixelLeft=X+(event.x-DS_x);

obj.style.pixelTop=Y+(event.y-DS_y);

}

}

/***调用代码**

<script language=javascript>

var myDate=new dateSelector();

myDate.year=1900;//morenqiri

myDate.inputName='date';//

myDate.display();

</script>

*/

html网页登录界面跳转设计

下面列了五个例子来详细说明,这几个例子的主要功能是:在5秒后,自动跳转到同目录下的hello.html(根据自己需要自行修改)文件。

1) html的实现

<head>

<!–以下方式只是刷新不跳转到其他页面–>

<meta http-equiv=”refresh” content=”10″>

<!–以下方式定时转到其他页面–>

<meta http-equiv=”refresh” content=”5;url=hello.html”>

</head>

优点:简单

缺点:Struts Tiles中无法使用

2) javascript的实现

<script language=”javascript” type=”text/javascript”>

//以下方式直接跳转

window.location.href='hello.html';

//以下方式定时跳转

setTimeout(“javascript:location.href='hello.html'”, 5000);

</script>

优点:灵活,可以结合更多的其他功能

缺点:受到不同浏览器的影响

3)结合了倒数的javascript实现(IE)

<span id=”totalSecond”>5</span>

<script language=”javascript” type=”text/javascript”>

var second= totalSecond.innerText;

setInterval(“redirect()”, 1000);

function redirect(){

totalSecond.innerText=–second;

if(second<0) location.href='hello.html';

}

</script>

优点:更人性化

缺点:firefox不支持(firefox不支持span、div等的innerText属性)

3')结合了倒数的javascript实现(firefox)

<script language=”javascript” type=”text/javascript”>

var second= document.getElementById('totalSecond').textContent;

setInterval(“redirect()”, 1000);

function redirect()

{

document.getElementById('totalSecond').textContent=–second;

if(second< 0) location.href='hello.html';

}

</script>

4)解决Firefox不支持innerText的问题

<span id=”totalSecond”>5</span>

<script language=”javascript” type=”text/javascript”>

if(navigator.appName.indexOf(“Explorer”)>-1){

document.getElementById('totalSecond').innerText=”my text innerText”;

} else{

document.getElementById('totalSecond').textContent=”my text textContent”;

}

</script>

5)整合3)和3')

<span id=”totalSecond”>5</span>

<script language=”javascript” type=”text/javascript”>

var second= document.getElementById('totalSecond').textContent;

if(navigator.appName.indexOf(“Explorer”)>-1){

second= document.getElementById('totalSecond').innerText;

} else{

second= document.getElementById('totalSecond').textContent;

}

setInterval(“redirect()”, 1000);

function redirect(){

if(second< 0){

location.href='hello.html';

} else{

if(navigator.appName.indexOf(“Explorer”)>-1){

document.getElementById('totalSecond').innerText= second–;

} else{

document.getElementById('totalSecond').textContent= second–;

}

}

}

</script>

参考

关于navigator.appname的内容到此结束,希望对大家有所帮助。

© 版权声明
THE END
喜欢就支持一下吧
点赞6 分享