为什么这用了JQuery就不能用自己写的JS了
<scripttype="text/javascript"src="../Script/menuJs.js"></script>//这是我自己写的JS<scripttyp...
<script type="text/javascript" src="../Script/menuJs.js"></script>
//这是我自己写的JS
<script type="text/javascript" src="../Script/jquery-1.7.2.min.js"></script>
//这个导的JQuery jar包
<script type="text/javascript">
$().ready(function(e) {
$("#wang1").click(function(){
$("#changeimage").attr("src","../images/onlinett.jpg");
});
$("#ping1").click(function(){
$("#changeimage").attr("src","../images/brandtt.jpg");
});
$("#new1").click(function(){
$("#changeimage").attr("src","../images/whatsnewtt.jpg");
});
$("#service1").click(function(){
$("#changeimage").attr("src","../images/servicett.jpg");
});
$("#me1").click(function(){
$("#changeimage").attr("src","../images/abouttt.jpg");
});
});
</script>
俩者只有一个效果。。 哪个高人知道的帮忙指点下。。。谢谢 展开
//这是我自己写的JS
<script type="text/javascript" src="../Script/jquery-1.7.2.min.js"></script>
//这个导的JQuery jar包
<script type="text/javascript">
$().ready(function(e) {
$("#wang1").click(function(){
$("#changeimage").attr("src","../images/onlinett.jpg");
});
$("#ping1").click(function(){
$("#changeimage").attr("src","../images/brandtt.jpg");
});
$("#new1").click(function(){
$("#changeimage").attr("src","../images/whatsnewtt.jpg");
});
$("#service1").click(function(){
$("#changeimage").attr("src","../images/servicett.jpg");
});
$("#me1").click(function(){
$("#changeimage").attr("src","../images/abouttt.jpg");
});
});
</script>
俩者只有一个效果。。 哪个高人知道的帮忙指点下。。。谢谢 展开
展开全部
把你的Script/menuJs.js贴上来 给你排错 可能是 $符冲突了
或者不用jq
$().ready(function(e) {
$("#wang1").click(function(){
$("#changeimage").attr("src","../images/onlinett.jpg");
});
$("#ping1").click(function(){
$("#changeimage").attr("src","../images/brandtt.jpg");
});
$("#new1").click(function(){
$("#changeimage").attr("src","../images/whatsnewtt.jpg");
});
$("#service1").click(function(){
$("#changeimage").attr("src","../images/servicett.jpg");
});
$("#me1").click(function(){
$("#changeimage").attr("src","../images/abouttt.jpg");
});
});
可以改成
window.onload=function(){
document.getElementById('wang1').onclick=function(){
document.getElementById('#changeimag').src="../images/onlinett.jpg";
};
document.getElementById('ping1').onclick=function(){
document.getElementById("#changeimage").src="../images/brandtt.jpg";
};
document.getElementById('new1').onclick=function(){
document.getElementById("#changeimage").src="../images/whatsnewtt.jpg";
};
document.getElementById('service1').onclick=function(){
document.getElementById("#changeimage").src="../images/servicett.jpg";
};
document.getElementById('me1').onclick=function(){
document.getElementById("#changeimage").src="../images/abouttt.jpg";
};
};
或者不用jq
$().ready(function(e) {
$("#wang1").click(function(){
$("#changeimage").attr("src","../images/onlinett.jpg");
});
$("#ping1").click(function(){
$("#changeimage").attr("src","../images/brandtt.jpg");
});
$("#new1").click(function(){
$("#changeimage").attr("src","../images/whatsnewtt.jpg");
});
$("#service1").click(function(){
$("#changeimage").attr("src","../images/servicett.jpg");
});
$("#me1").click(function(){
$("#changeimage").attr("src","../images/abouttt.jpg");
});
});
可以改成
window.onload=function(){
document.getElementById('wang1').onclick=function(){
document.getElementById('#changeimag').src="../images/onlinett.jpg";
};
document.getElementById('ping1').onclick=function(){
document.getElementById("#changeimage").src="../images/brandtt.jpg";
};
document.getElementById('new1').onclick=function(){
document.getElementById("#changeimage").src="../images/whatsnewtt.jpg";
};
document.getElementById('service1').onclick=function(){
document.getElementById("#changeimage").src="../images/servicett.jpg";
};
document.getElementById('me1').onclick=function(){
document.getElementById("#changeimage").src="../images/abouttt.jpg";
};
};
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询