實在是看不出哪里出錯了,指點一下
<!DOCTYPE html>
<html>
? ? <head>
? ? ? ? <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
? ? ? ?<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js" type="text/javascript"></script>
? ? ? ? ? ?
? ? ? ? <title>jQuery動畫特效</title>
? ? ? ? <style type="text/css">
? ? ? ? ? ? div{
? ? ? ? ? ? ? ? ?width:40px;
? ? ? ? ? ? ? ? ?height:40px;
? ? ? ? ? ? ? ? ?margin:10px;
? ? ? ? ? ? ? ? ?left:40px;
? ? ? ? ? ? ? ? ?border:2px solid;
? ? ? ? ? ? ? ? ?background:gray;
? ? ? ? ? ? ? ? ?position:absolute;
? ? ? ? ? ? ? ? }
? ? ? ? ? ?
? ? ? ? </style>
? ? </head>
? ??
? ? <body>
? ??
? ? ? ?<input type="button" value="左移" id="left"/>
? ? ? ?<input type="button" value="右移" id="right"/>
? ? ? ?<div></div>
? ? ? ?<span></span>
? ? ?<script type="test/javascript">
? ? ? ? ? $(function(){
? ? ? ? ? ? ? $("#left").bind("click",function(){
? ? ? ? ? ? ? ? ? $("div").animate({
? ? ? ? ? ? ? ? ? ? ? left:"+=10px"
? ? ? ? ? ? ? ? ? },1000,function(){
? ? ? ? ? ? ? ? ? ? $("span").html("左移了"); ?
? ? ? ? ? ??
? ? ? ? ? ? ? ? ? });
? ? ? ? ? ? ? });
? ? ? ? ? ? ?$("#right").bind("click",function(){
? ? ? ? ? ? ? ? ?$("div").animate({
? ? ? ? ? ? ? ? ? ? ?left:"-=10px"
? ? ? ? ? ? ? ? ?},1000,function(){
? ? ? ? ? ? ? ? ? ?$("span").html("右移了"); ?
? ? ? ? ? ? ? ? ?});
? ? ? ? ? ? ?});
? ? ? ? ??
? ? ? ? ? } );
? ? ? ?</script>
? ? </body>
</html>
2016-03-07
你自己寫的jQuery引入時<script type="test/javascript"> ? type應該是text。目測是寫test些順手了23333~~有過相似經(jīng)歷(捂臉……)沒事就省了寫type吧。。減少出錯幾率~\(^o^)/~
2016-03-07
改了,終于可以了。想哭啊