博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
2015/12/18
阅读量:4608 次
发布时间:2019-06-09

本文共 4480 字,大约阅读时间需要 14 分钟。

<html>

<head>

<script type = "text/javascript">

//输出下拉列表中所有选项的文本

function getOptions(){

var x = document.getElementById("mySelect");
var y = "";
for(var i = 0;i < x.length;i++){
y+= x.options[i].text;
y+="<br>"
}
document.write(y);
}

//锚的数组

function linkTo(y){

var x = ("http://tianmao.com","","scrollbars=yes,width=250,height=200");
}

//重新加载文档

function reLoad(){

window.location.reload();
}

//跳出框架

function breakout(){

if(window.top != window.self){
window.top.location = "htpp://www.baidu.com";
}
}

//禁用并启用下拉列表

function enable(){

document.getElementsById("mySelect").disabled = false;
}
function disable(){
document.getElementsById("mySelect").disabled = true;
}

//检测访问者的浏览器和版本号

var browser = navigator.appName;

var b_version = navigator.appVersion;
var version = parseInt(b_version);
document.write("浏览器名称:" +browser);
document.write("<br>");
document.write("浏览器版本:" + version);

//根据浏览器来提醒用户

function detectBrowser()

{
var browser=navigator.appName
var b_version=navigator.appVersion
var version=parseFloat(b_version)
if ((browser=="Netscape"||browser=="Microsoft Internet Explorer") && (version>=4))
{alert("您的浏览器已经很棒了!")}
else
{alert("您的浏览器需要升级了!")}
}

//更改下拉列表中的可见行数

function changeSize(){

document.getElementsById("mySelect").size = 5;
}

//改变下拉列表的可见行数

function selectMultiple()

{
document.getElementById("mySelect").multiple=true
}

//把用户带到一个新的地址

function currLocation(){

alert(window.location);
}
function newLocation(){
window.location = "http://www.baidu.com"
}

</script>

</head>

<body>

<form>

//把用户带到一个新的地址

<input type="button" οnclick="currLocation()" value="显示当前的url">
<input type="button" οnclick="newLocation()" value="改变Url">
</form>

//改变下拉列表的可见行数

<form>

<select id="mySelect" size="4">
<option>苹果</option>
<option>桃子</option>
<option>香蕉</option>
<option>桔子</option>
</select>
<input type="button" οnclick="selectMultiple()" value="选择多个">
</form>
<p>在您点击 “选择多个” 按钮之前,请尝试同时选取多个选项。在点击 “选择多个” 按钮之后,请再试一次。</p>

//更改下拉列表中的可见行数

<form>

<select id = "mySelect">
<option>name</option>
<option>age</option>
<option>color</option>
<option>home</option>
<option>money</option>
<option>love</option>
</select>
<input type="button" οnclick="changeSize()" value="change size">
</form>

//有关访问者的全部细节

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);

//有关访问者的浏览器的更多信息

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>")

//禁用并启用下拉列表

<form>

<select id="mySelect">
<option>唱歌</option>
<option>跳舞</option>
<option>弹钢琴</option>
<option>阅读</option>
</select>
<br><br>
<input type="button" οnclick="enable()" value="启用列表">
<input type="button" οnclick="disable()" value="禁用列表">
</form>

//跳出框架

<input type="button" οnclick="breakout()" value="跳出框架">

//重新加载文档

function reLoad(){

window.location.reload();
}

//输出下拉列表中所有选项的文本

<form>

Choose your favorite friut:
<select id = "mySelect" id = "4">
<option>apple</option>
<option>pear</option>
<option>orange</option>
<option>strawberry</option>
</select>
<input type="button" οnclick="getOptions" value="输出所有选项">

//锚的数组

<h3>Links and Anchors</h3>

<p>点击一个按钮,来显示第二个窗口的描</p>
<input type="button" οnclick="LinkTo()" value="1">
<input type="button" οnclick="LinkTo()" value="2">
<input type="button" οnclick="LinkTo()" value="3">
<input type="button" οnclick="LinkTo()" value="4">

</form>

</body>

</html>

转载于:https://www.cnblogs.com/whatcanido/p/5058281.html

你可能感兴趣的文章
HTTP 错误 500.21 - Internal Server Error 解决方案
查看>>
Bucks sign Sanders to $44 million extension
查看>>
【PHP】Windows下配置用mail()发送邮件
查看>>
Nhibernate和EF的区别
查看>>
基于java spring框架开发部标1078视频监控平台精华文章索引
查看>>
人类简史
查看>>
java 设计模式学习
查看>>
【Python使用】使用pip安装卸载Python包(含离线安装Python包)未完成???
查看>>
一语道破项目管理知识体系五大过程组
查看>>
C# 备份、还原、拷贝远程文件夹
查看>>
在windows环境下运行compass文件出现的错误提示解决方案
查看>>
CSS常用样式--font
查看>>
恩如氏--蜗牛精华补水蚕丝面膜
查看>>
大工具-收藏
查看>>
codevs3027 线段覆盖 2
查看>>
markdown
查看>>
【leetcode】107-Binary Tree Level Order Traversal II
查看>>
Jquert data方法获取不到数据,显示为undefined。
查看>>
ssm项目中 数据库和资源的备份
查看>>
HDU5950【矩阵快速幂】
查看>>