window.onload=initForm;
var xhr = false;
if (window.XMLHttpRequest) {
xhr = new XMLHttpRequest();
}
else {
if (window.ActiveXObject) {
try {
xhr = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e) { }
}
}
function initForm(){
duqu();
document.getElementById("plan_menu").selectIndex=100;
document.getElementById("plan_menu").onchange=jumpPage;
return false;
}
function jumpPage(){
if (xhr) {
var newLoc=document.getElementById("plan_menu");
var newPage=newLoc.options[newLoc.selectedIndex].value;
var newUrl="plan.do?method=readPlan&title="+newPage;
xhr.open("GET", newUrl, true);
xhr.onreadystatechange = showMyProject;
xhr.send();
}
}
function showMyProject() {
if (xhr.readyState == 4) {
if (xhr.status == 200) {
var tt=document.getElementById("tuodongqun");
tt.innerHTML=xhr.responseText;
}
}
}
目前要实现一个select下拉列表改变值之后就调用jumpage然后用ajax把参数提交给url,但是多次测试进不到我服务端的方法(我用的是struts1的action)……超链接跳转倒是可以……代码如下
function jumpPage(){
var newLoc=document.getElementById("plan_menu");
var newPage=newLoc.options[newLoc.selectedIndex].value;
var newUrl="plan.do?method=readPlan&title="+newPage;
if (newPage!=""){
window.location=newUrl;
}
}
------解决方案--------------------
1、看下浏览器的控制台 看有没有报js错误
2、吧 下面这段代码写到jumppage方法里试试
var xhr = false;
if (window.XMLHttpRequest) {
xhr = new XMLHttpRequest();
}
else {
if (window.ActiveXObject) {
try {