JAVAscript學習筆記 jsBOM 第七節 (原創) 參考js使用表

來源:互聯網
上載者:User

標籤:周杰倫   cti   val   tco   var   new   傳回值   定時   stc   

<html>    <head>        <title>day02_js</title>        <script type="text/javascript" language="javascript" src="js/test1.js"></script>    </head>    <body>        <form>            <h2>1.BOM示範針對window</h2>            <input type="button" onclick="testConfirm()" value="confirm測試"/><br/><br/>            <input type="button" onclick="testPromp()" value="promp測試"/><br/><br/>            <input type="button" onclick="openTest()" value="open測試"/><br/><br/>            <input type="button" onclick="closeTest()" value="close測試"/><br/><br/>            <input type="button" onclick="refreshTest()" value="refresh測試"/><br/><br/>            <input/><br/><br/>            <input type="button" onclick="naviTest()" value="控制台查看資訊測試"/><br/><br/>            <input type="button" onclick="TimeTest()" value="計時開始"/>            <input type="button" onclick="clearTime()" value="計時結束"/>            <input id="i1"/><br/><br/>        </form>    </body></html>
function testConfirm(){    var f = window.confirm("你確定此操作嗎?");  //確定加取消的彈出框   參數自訂,傳回值為點擊確定=true,點擊取消=false;    alert(f);  //列印返回的boolean值}function testPromp(){    var f = window.prompt("請輸入使用者名稱","周杰倫");     //提示加text加確定加取消彈出框    第一個參數提示,第二個參數預設值    alert(f);  //列印輸入框中的值 點即取消則返回null}function openTest(){    //window.open("http://www.baidu.com");//開啟一個新頁面    var config = "toolbar=yes,width=500,height=300";  //toolbar顯示工具列    window.open("http://www.baidu.com","1",config)  //  參數1為自訂,否則不能按照config的大小開啟新的視窗}function closeTest(){    window.close();     //關閉當前頁面}function refreshTest(){    window.location.reload();  //頁面重新整理}function naviTest(){    var arr = new Array(5);    console.dir(arr);  //console.dir()可以在控制台顯示一個對象所有的屬性和方法。    //console.log(window.navigator.appVersion);  //會在瀏覽器控制台列印出資訊。   查看當前瀏覽的版本    //console.dir(window.navigator.appVersion);}var timer;             //window定時器function TimeTest(){    timer = window.setInterval(‘func()‘,100);}var count = 0;function func(){    count++;    document.getElementById("i1").value= count;}function clearTime(){    window.clearInterval(timer);}

 

JAVAscript學習筆記 jsBOM 第七節 (原創) 參考js使用表

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.