[JavaScript学习记录] BOM小记
浏览器对象模型(Browser Object Model)
浏览器对象包括
Window(窗口)
Navigator(浏览器)
Screen (客户端屏幕)
History(访问历史)
Location(浏览器地址)
目录
History
history.go(-2); //-1表示上次,-2表示上上次,以次类推
History使用有前提,无论你使用的是a标签还是button, target不可以是_blank,其余属性(_self、_parent、_top、framename)都可以。
Nevigator
(浏览器对象,提供浏览器相关的信息)
| .appName | 浏览器产品名称 |
| .appVersion | 浏览器版本号 |
| .appCodeName | 浏览器内部代码 |
| .platform | 操作系统 |
| .cookieEnabled | 是否启用Cookies |
| .userAgent | 浏览器的用户代理报头 |

弹框
警告框alert
确认框conform
var d = confirm("是否要删除");
if(type(d)==true){
alert("哈哈哈哈");
}else{
alert("呜呜呜呜");
}

"确定"

"取消"

输入框
<script>
function p(){
var name = prompt("请输入用户名:");
alert("您输入的用户名是:" + name);
}
</script>
<button onclick="p()">请输入用户名</button>


本文来自博客园,作者:泥烟,CSDN同名, 转载请注明原文链接:https://www.cnblogs.com/Knight02/p/15799141.html

浙公网安备 33010602011771号