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