JavaScript 基礎概念紀錄

  • 48
  • 0

JavaScript 基礎概念紀錄

直接轉址可以透過window.location或是location.href這兩個方法,

如下原來會先根據window.location轉址到yahoo,但又遇到location.href會再轉址到google。
 

<head>
    <script type="text/javascript">
        window.location = "http://www.yahoo.com.tw"
        location.href = "http://www.google.com/"
    </script>
</head>