开发者

Help with Javascript in wordpress

I'm trying to add a java script slide show to my wordpress home page. In my theme folder I have a js folder and then in that I have jquery.cross-slide.min.js and jquery.min.js

This is what I have and what I'm pasting into my post area

<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.cross-slide.min.js"></script>

开发者_如何学JAVA<script type="text/javascript">
function() {
crossSlide({
sleep: 3,
fade: 1
}, [
{ src: 'images/slideshows/block1.jpg' },
{ src: 'images/slideshows/block2.jpg' },
{ src: 'images/slideshows/block3.jpg' }
])
});
</script>

If I paste this into a wordpress page throught the html editor it doesn't work. Please could you check for errors and advice.


See the Wordpress Codex: JavaScript in Posts.

For the occasional or one time use of Javascript, you need to put the script into a Javascript file and then call it out from within the post. Make sure that each script is defined by its function name such as:

function updatepage(){var m="Page updated "+document.lastMo.......}

To include a Javascript inside a post, you need to combine both the call to the script file with the call to the Javascript itself.

<script type="text/javascript" src="/scripts/updatepage.js"></script>
<script type="text/javascript">
<!--
updatepage();
//--></script>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜