0
我一直試圖通過多種查看方式使我的代碼功能很好,例如Web Archive和PHProxy。下面是代碼:將我的代碼加載到Web上存檔和JavaScript無法正常工作
<select id="mySelect" OnChange="window.location.href=this.value">
<option>Tagged Stuff and Navigation</option>
</select>
<script>
if (window.location.href.substring(0, 9) === "http://th") {
var home_var = "/";
var bio_var = "/tagged/bio";
var ask_var = "/ask";
} else if (window.location.href.substring(0, 9) === "https://p") {
var home_var = "https://px.multiscreensite.com/index.php?url=blog.tumblr.com";
var bio_var = "https://px.multiscreensite.com/index.php?url=blog.tumblr.com/tagged/bio";
var ask_var = "https://px.multiscreensite.com/index.php?url=blog.tumblr.com/ask";
} else if (window.location.href.substring(0, 9) === "https://w") {
var home_var = "blog.tumblr.com";
var bio_var = "blog.tumblr.com/tagged/bio";
var ask_var = "blog.tumblr.com/ask";
}
var select = document.getElementById("mySelect");
var option = document.createElement("option");
var option1 = document.createElement("option");
var option2 = document.createElement("option");
option.text = "Home Page";
option.value = home_var;
select.add(option);
option1.text = "Autobiographys";
option1.value = bio_var;
select.add(option1);
option2.text = "Ask Me Stuff";
option2.value = ask_var;
select.add(option2);
</script>
我的具體問題是通過Web歸檔打開我的頁面時,變量從來沒有得到正確定義,因此所有的值的問世爲「不確定」。這是Web檔案的問題,還是無論如何,我可以解決這個問題?
謝謝!我會嘗試。 –