-2

我的网站是:http ://server1.bioprotege-inc.net/permanent_Files/digichat_admin_panel/#Home

显示“主页”的链接会下拉我指定 id 喜欢做什么但无法开始工作的内容是使用下拉菜单上的选项之一来删除与主页链接相同的内容,但我无法得到它像那样工作和建议?

// JavaScript Document



$(document).ready(function(){


    $("#Home").click(function(){
                Load_ajax_page("Content_Files/Home.html");
    });


    $("#Chat").click(function(){
                Load_ajax_page("Content_Files/Chat.html");
    });


    $("#Rules_List").click(function(){
                Load_ajax_page("Content_Files/Rules_List.html");
    });


    $("#The_Team").click(function(){
                Load_ajax_page("Content_Files/The_Team.html");
    });


    $("#Forums").click(function(){
                Load_ajax_page("Content_Files/Forums.html");
    });

});



function Load_ajax_page(url){


    //this is a jquery method to make a ajax request
    $.post(url,"",function (data){
        //this is the place where the data is returned by the request
        //remove loading and add the data
        $("#response").html(data);
    });

}






HTML CODE NOW FOR DROPDOWN MENU:


<form onclick="">
<select onchange="window.open(this.options[this.selectedIndex].value,'_top')" style="width:582px; height:25px;">
<option value="#">Enter Free Hosted Sites:</option>
<option value="#"></option>
<option value="#Home">Hosted1 - Shadow Hunters</option>
<option value="http://www.google.com">Hosted2</option>
<option>Hosted3</option>
<option>Hosted4</option>
</select>
</form>

<br />

<div id="response"></div>
4

1 回答 1

0

您可以使用以下代码:

<script type="text/javascript">
try{
xmlhttp = new XMLHttpRequest();
}
catch(ee){
try{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e){
try{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(E){
xmlhttp = false;
}
}
}
div_base = "";
valor = 0;
function abre(arquivo,metodo,div){
div_base = div;
valor++;
xmlhttp.open(metodo,arquivo+"?valor="+valor);
xmlhttp.onreadystatechange=response
xmlhttp.send(null)
}
function response() {
nova_div = div_base;
document.getElementById(nova_div).innerHTML="<div style='top:50%;left:50%;position:absolute;'>Loading...</div>"
if (xmlhttp.readyState==4){
document.getElementById(nova_div).innerHTML=xmlhttp.responseText
}
}
</script>

<form>
<select name="menu">
<option onclick="javascript: abre('Content_Files/Home.html','GET','response');">Home</option>
<option onclick="javascript: abre('Content_Files/Chat.html','GET','response');">Chat</option>
<option onclick="javascript: abre('Content_Files/Rules_List.html','GET','response');">Rules_List</option>
<option onclick="javascript: abre('Content_Files/The_Team.html','GET','response');">The_Team</option>
<option onclick="javascript: abre('Content_Files/Forums.html','GET','response');">Forums</option>
</select>
</form>
<br /><br />
<div id="response"></div>
于 2012-06-02T23:44:35.597 回答