2 qq 40031280 qq_40031280 于 2017.08.30 17:22 提问

jquery中load()只能执行一次

if(window.location.href.split("=")[1]==0){
$("#reading").load("reading_late_qing.html")
}else if(window.location.href.split("=")[1]==1){
$("#reading").load("reading_republic_china.html")
}else if(window.location.href.split("=")[1]==2){
$("#reading").load("reading_civil.html")
}else if(window.location.href.split("=")[1]==3){
$("#reading").load("reading-anti-japanese.html")
}else if(window.location.href.split("=")[1]==4){
$("#reading").load("reading_liberation.html")
}else if(window.location.href.split("=")[1]==5){
$("#reading").load("reading_socialist.html")
}else if(window.location.href.split("=")[1]==6){
$("#reading").load("reading_reform.html")
}
实际在当前页面加载了一次后点其他的就返回原先的页面后再点击才执行这个怎么解决

3个回答

oliver_105397
oliver_105397   2017.08.30 17:41

方法写在$(function(){})或者$(document).ready(function(){})里面

ActionSnail
ActionSnail   2017.08.30 22:47

$(function(){})

huang931027
huang931027   2017.08.31 08:46

$(function(){})

Csdn user default icon
上传中...
上传图片
插入图片