首先感謝Dev Chen & sideroxylon回答我以前的問題。我幾乎接近解決方案,但它不工作......?請更正此Javascript代碼?從表格
在下面的代碼,我們從用戶&獲得值1 &值2時,他按下GO按鈕,它道出
http:// foo.com/document/ value1/value2 /pageview.html
本準則是OK!它提供了一個警報,但當我改變它轉到URL它不在我手中工作,請給它看看?
HTML
A: <input type="text" id="value1"/><br />
B: <input type="text" id="value2" /> <br />
<input type="button" value="GO!" onclick="redirect()" />
的Javascript
function redirect() {
alert("Set window.location to:http://www.foo.com/document" + document.getElementById("value1").value + "/" + document.getElementById("value2").value + "/printview.html");
}
(這裏是老問題http://goo.gl/x85m6H)
它的提供和警報...如何更改它,使其轉到URL。
它的Alert函數如何讓它計算出鏈接?
到http:
window.location.href = newUrl;
你
redirect
功能可以改變// ...'。它通過文字告訴你你需要做什麼。你有嘗試過嗎? –