Javascript – How does it work in posts? code included
-
Hi,
I have the following code working in a standard HTML page how do I get it to work in a wordpress post?
What parts of the code do I put in the post and what parts of the code do I put in an external javasript .js file?
I would really appreciate if someone who knows javascript in wordpress to help to split the code up so that I can copy and paste into the post and an external javascript file.
Please HELP !!!
<html>
<head>
<title>JW API Example 5-2-3-0 – JW FLV Media Player</title>
<script type=”text/javascript” src=”swfobject.js”></script>
<script type=”text/javascript”>
var player = null;
function playerReady(thePlayer) {
player = document.getElementById(thePlayer.id);
}
function createPlayer(thePlayer, theFile) {
var flashvars = {
file:theFile,
autostart:”false”,
playlist:”bottom”,
playlistsize:”250″,
shuffle:”false”,
autoscroll:”false”,
volume:”50″
}
var params = {
allowfullscreen:”true”,
allowscriptaccess:”always”
}
var attributes = {
id:thePlayer,
name:thePlayer
}
swfobject.embedSWF(“player.swf”, “placeholder1”, “480”, “620”, “9.0.115”, false, flashvars, params, attributes);
}
</script>
<style type=”text/css”>
<!–
.style1 {
font-family: Geneva, Arial, Helvetica, sans-serif;
font-weight: bold;
vertical-align: middle;
}
–>
</style>
</head>
<body bgcolor=”#DDDDDD” onLoad=”createPlayer(‘player1’, ‘playlist_mp3.xml’)”>
<p>
<span class=”style1″>Select a playlist: </span>
<select name=”sel1″ onChange=”javascript:player.sendEvent(‘STOP’); player.sendEvent(‘LOAD’, this.value);” style=”width:auto;”>
<option value=”playlist_mp3.xml” selected>MP3</option>
<option value=”playlist_mixmedia.xml”>Mixed</option>
<option value=”playlist_birds.xml”>Birds</option>
<option value=”playlist_remember.xml”>Remember</option>
</select></p>
<div id=”placeholder1″>
Get flash to see this player
</div>
</body>
</html>
The topic ‘Javascript – How does it work in posts? code included’ is closed to new replies.