0
点赞
收藏
分享

微信扫一扫

window对象中的location、screen、navigator、history


window对象中的location、screen、navigator、history_css

window对象中的location、screen、navigator、history_css_02

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<style type="text/css">
body{text-align:center}
.txt{border:1px solid #000;font:10pt;color:gray}
</style>
<script type="text/javascript">
function currLoc(){
document.getElementById('txtContent').value = location;//显示当前页的路径
}

function changeLoc(){
location = document.getElementById('txtContent').value;//转向框内输入的地址
}
//location.replace("../5.2/time.html");
</script>
</head>

<body>
<br/>
<input type="button" οnclick="currLoc()" value="我在哪儿">
<input type="button" οnclick="changeLoc()" value="我去哪儿">
<br/><br/>
<input type="text" size="50" id="txtContent" class="txt"/>
</body>

</html>



window对象中的location、screen、navigator、history_html_03

显示当前页的路径

window对象中的location、screen、navigator、history_javascript_04

window对象中的location、screen、navigator、history_html_05

window对象中的location、screen、navigator、history_对象_06

.htmld代码如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>screen对象用法</title>
<style type="text/css">
#result{width:400px;border:1px solid #bc0;line-height:24px;padding-top:5px;padding-left:5px;font:11pt;color:gray;font-weight:bold}
</style>
<script type="text/javascript">
function getScreenInfo(){
var str="屏幕尺寸基本信息:<br/>";

str += "屏幕宽度:"+screen.width+"像素<br/>";
str += "屏幕高度:"+screen.height+"像素<br/>";
str += "屏幕可用宽度:"+screen.availWidth+"像素<br/>";
str += "屏幕可用高度:"+screen.availHeight+"像素";

document.getElementById("result").innerHTML = str;
}
</script>
</head>

<body οnlοad="getScreenInfo()">

<div id="result"></div>
</body>

</html>


window对象中的location、screen、navigator、history_html_07

window对象中的location、screen、navigator、history_html_08


.html代码如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>navigator用法</title>
<style type="text/css">
#result{width:400px;border:1px solid #bc0;line-height:24px;padding-top:5px;padding-left:5px;font:11pt;color:gray;font-weight:bold}
</style>
<script type="text/javascript">
function get_userInfo(){
var str="基本信息:<br/>";
var name = window.navigator.appName;

str += "浏览器名称:"+name+"<br/>";
str += "浏览器版本:"+window.navigator.appVersion+"<br/>";
str += "操作系统版本:"+navigator.platform+"<br/>";
var language="";
if(name == "Microsoft Internet Explorer"){
if(navigator.systemLanguage == "zh-cn"){
language ="简体中文";
}else{
language = navigator.systemLanguage;
}
}else{
if(navigator.language == "zh-cn"){
language ="简体中文";
}else{
language = navigator.language;
}
}
str +="系统默认的语言:"+language+"<br/>";
str +="是否支持java语言:";
str +=navigator.javaEnabled==true?"支持":"不支持";

document.getElementById("result").innerHTML = str;
}

</script>
</head>

<body οnlοad="get_userInfo()">

<div id="result"></div>
</body>

</html>


window对象中的location、screen、navigator、history_css_09


window对象中的location、screen、navigator、history_css_10

window对象中的location、screen、navigator、history_css_11

举报

相关推荐

0 条评论