开发者

Jquery code not working in JSP page

I have piece of jquery code for animation which is working in plain HTML page but not working in JSP page here is mine code

<scri开发者_Go百科pt src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript"></script>
<script src="http://dev.jquery.com/view/trunk/plugins/color/jquery.color.js" type="text/javascript"></script>
<script>
    $('#totalCost1').stop().animate({ backgroundColor: '#ffe000' }, 250).animate({ backgroundColor: '#f0f0f0'}, 750);
    $('#coop1').stop().animate({ backgroundColor: '#ffe000' }, 250).animate({ backgroundColor: '#f0f0f0'}, 750);
    $('#outOfPocket1').stop().animate({ backgroundColor: '#ffe000' }, 250).animate({ backgroundColor: '#f0f0f0'}, 750);
</script>


your js code must be in <script></script> tags

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript"></script>
<script src="http://dev.jquery.com/view/trunk/plugins/color/jquery.color.js" type="text/javascript">
 $('#totalCost1').stop().animate({ backgroundColor: '#ffe000' }, 250).animate({ backgroundColor: '#f0f0f0'}, 750);
        $('#coop1').stop().animate({ backgroundColor: '#ffe000' }, 250).animate({ backgroundColor: '#f0f0f0'}, 750);
        $('#outOfPocket1').stop().animate({ backgroundColor: '#ffe000' }, 250).animate({ backgroundColor: '#f0f0f0'}, 750);</script>


The below should work. If you have JQuery script at:

/MyApp/WebContent/scripts/jquery-1.6.2.js

You need to refer in any JSP / FTL as following: if JSP is at :

/MyApp/WebContent/pages/user/listUsers.jsp

In JSP refer stylesheet as:

<link rel="stylesheet" type="text/css" href="/myapp/styles/myStyle.css"/>

In JSP refer JQuery as :

<script type="text/javascript" src="/myapp/scripts/jquery-1.6.2.js"></script>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜