js window --浏览器对象模型
来源:互联网 发布:.store域名值钱吗 编辑:程序博客网 时间:2024/05/16 07:13
5、window.navigator 对象包含有关访问者浏览器的信息。
例子:
<div id="example"></div><script>txt = "<p>Browser CodeName: " + navigator.appCodeName + "</p>";txt+= "<p>Browser Name: " + navigator.appName + "</p>";txt+= "<p>Browser Version: " + navigator.appVersion + "</p>";txt+= "<p>Cookies Enabled: " + navigator.cookieEnabled + "</p>";txt+= "<p>Platform: " + navigator.platform + "</p>";txt+= "<p>User-agent header: " + navigator.userAgent + "</p>";txt+= "<p>User-agent language: " + navigator.systemLanguage + "</p>";document.getElementById("example").innerHTML=txt;</script>
结果:
Browser CodeName: Mozilla
Browser Name: Netscape
Browser Version: 5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36
Cookies Enabled: true
Platform: Win32
User-agent header: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36
User-agent language: undefined
6、JS PopupAlert 消息框
6-1警告框、确认框、提示框
alter("111");
confirm("Press a button!");
提示框:(
提示框经常用于提示用户在进入页面前输入某个值。
当提示框出现后,用户需要输入某个值,然后点击确认或取消按钮才能继续操纵。
如果用户点击确认,那么返回值为输入的值。如果用户点击取消,那么返回值为 null。
)prompt("请输入您的名字","Bill Gates") ;
7、计时
setTimeOut("alert("ok")", 5000);
警示框在5000毫秒(5秒后)弹出
例子:
<html>
<head>
<script type="text/javascript">
function timedText()
{
var t1=setTimeout("document.getElementById('txt').value='2 秒'",2000)
var t2=setTimeout("document.getElementById('txt').value='4 秒'",4000)
var t3=setTimeout("document.getElementById('txt').value='6 秒'",6000)
}
</script>
</head>
<body>
<form>
<input type="button" value="显示计时的文本" onClick="timedText()">
<input type="text" id="txt">
</form>
<p>点击上面的按钮。输入框会显示出已经逝去的时间(2、4、6 秒)。</p>
</body>
</html>
- js window --浏览器对象模型
- Window - 浏览器对象模型
- JavaScript Window-浏览器对象模型
- JavaScript Window - 浏览器对象模型
- JavaScript Window - 浏览器对象模型
- Javascript Window浏览器对象模型
- javscript WINDOW 浏览器对象模型
- JavaScript Window - 浏览器对象模型
- JavaScript Window - 浏览器对象模型
- JavaScript Window - 浏览器对象模型
- JavaScript Window-浏览器对象模型
- JavaScript Window浏览器对象模型
- JavaScript Window-浏览器对象模型
- 浏览器对象模型BOM之window对象
- JavaScript Window- 浏览器对象模型和W3C
- JavaScript Window -浏览器对象模型(BOM)
- JS浏览器对象BOM模型
- js -BOM浏览器对象模型
- adb shell提示device offline
- finally语句块的作用
- 64位Ubuntu kylin 16.04使用fastboot下载内核到tiny4412开发板
- JAVA 学习日记(4).JDBC
- EditText setfocusable 无效
- js window --浏览器对象模型
- You should blog even if you have no readers
- xxx.app: resource fork, Finder information, or similar detritus not allowed
- equals和HashCode深入理解以及Hash算法原理
- JS验证IP
- UIButton左文字右图片,上图片下文字
- uva 10325 The Lottery (容斥原理)dfs枚举 或二进制枚举
- tomcat Could not find or load main class org.apache.catalina.startup.Bootstrap
- 《JAVA与模式》之适配器模式