My codes are like this.
function deleteAction(obj,tableName){
inputs=obj.parentNode.parentNode.getElementsByTagName("input");
newValues="";
for(i=0;i<inputs.length;i++){
newValues+=inputs[i].value+",";
}
url="http://localhost:8081/SimpleWeb/SimpleServlet?action=delete&tableName="+tableName+"&newValue="+newValues;
window.location.href=url;
}
I have made sure that that function will be run when I click on the button with Chrome's debug.
And the string url is valid because I can copy it to the browser and open the page correctly.
But in this function the window.location.href
just doesn't work even if I change the url into " http://google.com "...Why
is i
variable global? After looking well, I suggest you change from this
for(i=0;i<inputs.length;i++){
newValues+=inputs[i].value+",";
}
to
for(var j=0;j<inputs.length;j++){
newValues+=inputs[j].value+",";
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.