js手册学习--Image 对象--Location 对象--Navigator
来源:互联网 发布:ie8中文版官方mac 编辑:程序博客网 时间:2024/05/16 20:27
转载:http://www.w3school.com.cn/example/hdom_examples.asp
1.1更改图像的高度和宽度
<html><head><script type="text/javascript">function changeSize(){document.getElementById("compman").height="270"document.getElementById("compman").width="164"}</script></head><body><img id="compman" src="/i/eg_bulbon.gif" /><br /><br /><input type="button" onclick="changeSize()" value="改变图像的高度和宽度"></body></html>
2.1更改图像的 src
<html><head><script type="text/javascript">function changeSrc() { document.getElementById("myImage").src="/i/eg_smile.gif" }</script></head><body><img id="myImage" src="/i/eg_bulbon.gif" /><br /><br /><input type="button" onclick="changeSrc()" value="改变图像"></body></html>
Location 对象
3.1把用户带到一个新的地址
<html><head><script type="text/javascript">function currLocation(){alert(window.location)}function newLocation(){window.location="/index.html"}</script></head><body><input type="button" onclick="currLocation()" value="显示当前的 URL"><input type="button" onclick="newLocation()" value="改变 URL"></body></html>
4.1重新加载文档
<html><head><script type="text/javascript">function reloadPage(){window.location.reload();}</script></head><body><input type="button" value="重新加载页面" onclick="reloadPage()" /></body></html>
5.1跳出框架
<html><head><script type="text/javascript">function breakout() { if (window.top!=window.self) { window.top.location="/example/hdom/tryjs_breakout.htm" } }</script></head><body><input type="button" onclick="breakout()" value="跳出框架!"></body></html>
Navigator
6.1检测访问者的浏览器和版本号<html><body><script type="text/javascript">var browser=navigator.appNamevar b_version=navigator.appVersionvar version=parseFloat(b_version)document.write("浏览器名称:"+ browser)document.write("<br />")document.write("浏览器版本:"+ version)</script></body></html>
7.1有关访问者的浏览器的更多信息
<html><body><script type="text/javascript">document.write("<p>浏览器:")document.write(navigator.appName + "</p>")document.write("<p>浏览器版本:")document.write(navigator.appVersion + "</p>")document.write("<p>代码:")document.write(navigator.appCodeName + "</p>")document.write("<p>平台:")document.write(navigator.platform + "</p>")document.write("<p>Cookies 启用:")document.write(navigator.cookieEnabled + "</p>")document.write("<p>浏览器的用户代理报头:")document.write(navigator.userAgent + "</p>")</script></body></html>
8.1有关访问者的浏览器的全部细节
<html><body><script type="text/javascript">var x = navigator;document.write("CodeName=" + x.appCodeName);document.write("<br />");document.write("MinorVersion=" + x.appMinorVersion);document.write("<br />");document.write("Name=" + x.appName);document.write("<br />");document.write("Version=" + x.appVersion);document.write("<br />");document.write("CookieEnabled=" + x.cookieEnabled);document.write("<br />");document.write("CPUClass=" + x.cpuClass);document.write("<br />");document.write("OnLine=" + x.onLine);document.write("<br />");document.write("Platform=" + x.platform);document.write("<br />");document.write("UA=" + x.userAgent);document.write("<br />");document.write("BrowserLanguage=" + x.browserLanguage);document.write("<br />");document.write("SystemLanguage=" + x.systemLanguage);document.write("<br />");document.write("UserLanguage=" + x.userLanguage);</script></body></html>
9.1根据浏览器来提醒用户
<html><head><script type="text/javascript">function detectBrowser(){var browser=navigator.appNamevar b_version=navigator.appVersionvar version=parseFloat(b_version)if ((browser=="Netscape"||browser=="Microsoft Internet Explorer") && (version>=4)) {alert("您的浏览器已经很棒了!")}else {alert("您的浏览器需要升级了!")}}</script></head><body onload="detectBrowser()"></body></html>
- js手册学习--Image 对象--Location 对象--Navigator
- 学习 JS navigator 对象
- 学习 JS navigator 对象
- 学习 JS navigator 对象
- 原生JS(1)BOM,navigator,location,screen对象
- JavaScript:Location对象和Navigator对象
- javascript基础:navigator对象、location对象
- JS navigator 对象
- js navigator对象
- JS Navigator对象
- js的navigator对象
- js: navigator.plugin对象
- js的Navigator对象
- js之Navigator对象
- js的navigator对象
- JS:浏览器 Navigator 对象
- Js之Navigator对象
- JavaScript-navigator对象学习
- Boost库的命名规则及静态编译命令。
- 各种排序算法的稳定性和时间复杂度小结
- 1.6.2 Minesweeper
- 内部控制十大漏洞
- oracle 设置默认表空间
- js手册学习--Image 对象--Location 对象--Navigator
- Android源码从下载到编译全过程
- linux添加硬盘
- Android 2.3 SD卡挂载流程浅析(二)
- http://acm.hdu.edu.cn/showproblem.php?pid=1272
- ADF中Customize用户自己的inputListOfValues
- VC++6.0中注释多行代码的快捷键
- redo重做日志管理
- RHEL6.1 中VNC部署