<progress id="btth9"></progress>
<sub id="btth9"><thead id="btth9"><font id="btth9"></font></thead></sub>

<sub id="btth9"></sub>

      <big id="btth9"></big>

      <progress id="btth9"></progress>

      <big id="btth9"></big>

      win7系統下載
      當前位置: 首頁 > 硬件軟件教程 > 詳細頁面

      JavaScript圖文教程之創建一個歡迎cookie_javascript

      發布時間:2021-12-27 文章來源:xp下載站 瀏覽:

      軟件是一系列按照特定順序組織的計算機數據和指令的集合。一般來講軟件被劃分為編程語言、系統軟件、應用軟件和介于這兩者之間的中間件。硬件是“計算機硬件”的簡稱。與“軟件”相對,電子計算機系統中所有實體部件和設備的統稱。

        如果嫌棄自己的頁面太單調不妨設置一個歡迎頁面,這樣的頁面用JavaScript也能實現,大家熟知下下面的代碼吧。

      JavaScript教程之創建一個歡迎cookie
      JavaScript教程之創建一個歡迎cookie

        《/P》

        《P》《html》

        《head》

        《script type=“text/javascript”》

        function getCookie(c_name)

        {

        if (document.cookie.length》0)

        {

        c_start=document.cookie.indexOf(c_name + “=”)

        if (c_start!=-1)

        {

        c_start=c_start + c_name.length+1

        c_end=document.cookie.indexOf(“;”,c_start)

        if (c_end==-1) c_end=document.cookie.length

        return unescape(document.cookie.substring(c_start,c_end))

        }

        }

        return “”

        }《/P》

        《P》function setCookie(c_name,value,expiredays)

        {

        var exdate=new Date()

        exdate.setDate(exdate.getDate()+expiredays)

        document.cookie=c_name+ “=” +escape(value)+

       。ǎ╡xpiredays==null) ? “” : “; expires=”+exdate.toGMTString())

        }《/P》

        《P》function checkCookie()

        {

        username=getCookie(‘username’)

        if (username!=null && username!=“”)

        {alert(‘Welcome again ’+username+‘!’)}

        else

        {

        username=prompt(‘Please enter your name:’,“”)

        if (username!=null && username!=“”)

        {

        setCookie(‘username’,username,365)

        }

        }

        }

        《/script》

        《/head》

        《body onLoad=“checkCookie()”》

        《/body》

        《/html》


      硬件是實在的,有模有樣的。軟件是程序性的。是一系列的指令。有了軟件,硬件才會實現更豐富的功能。

      日本不卡免费新一区二区三区