我一直在試圖創建這個鉻擴展,你輸入一個地址,然後點擊一個按鈕,它就會去那裏。這可能聽起來像一個愚蠢的想法,但不知何故,一個網站上的服務器塊被鉻擴展繞過。這是我當前的代碼:代碼清除頁面,而不是去新的網站
<html>
<head>
<title>Website Opener</title>
<style type="text/css">
body
{
font-family: "Lucida Grande";
height: 100%;
}
</style>
<script>
$(document).ready(function() {
$('#url').change(function() {
var newurl = $('#url').val();
$('a.target').attr('href', newurl);
});
});
</script>
</head>
<body>
<form>
<input type="text" id='url' value='http://'>
<br>
<p><a class="target" href="">Go!</a></p>
</form>
</body>
</html>
什麼它目前不只是使頁面空白或透明的而不是去新網站的輸入框。
我已經嘗試過javascript .open()方法,這是嘗試jQuery。我主要想知道是否有其他方法來做到這一點,或者如果我錯過了一些東西。
在點擊鏈接之前將鼠標懸停在鏈接上。目標網址應顯示在窗口底部的狀態欄中。 –
你試過了window.location.href = newurl; ? – cakan
正如我所見,您沒有將jQuery腳本附加到您的頁面。 – kuzzmi