3Talks 港人自講討論區 » Xanga & MSN Space 部落格專區 » 【xanga】music: drop down playlist


2006-8-17 11:39 PM [kae′]
【xanga】music: drop down playlist

You can paste this code in either your Custom Header or your Website Stats, depending on where you want it.

<!-- begin code provided by createblog.com -->
<object id="darkplayer" codeBase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" type="application/x-oleobject" height="0" standby="Loading Microsoft Windows Media Player components..." width="0" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95">
<param NAME VALUE>
<param NAME="ShowControls" VALUE="0">
<param NAME="ShowStatusBar" VALUE="0">
<param NAME="ShowDisplay" VALUE="0">
<param NAME="DefaultFrame" VALUE="Slide">
<param NAME="Autostart" VALUE="1">
<param NAME="Loop" VALUE="True">
</object>
<form name="form">
<select name="playlist" size="1">

<!-- Add song info here -->
<option value="0">Artist Name - Song Title</option>
<option value="1">Artist Name - Song Title</option>
<option value="2">Artist Name - Song Title</option>
<option value="3">Artist Name - Song Title</option>
<option value="4">Artist Name - Song Title</option>

</select>
<input TYPE="BUTTON" NAME="darkplay" VALUE="play" OnClick="play(document.forms['form'].playlist);">
</form>

<script language="JavaScript">
<!--
var playstate = 1;
shuffle = 1;  // Set to 0 to always play first song in list
              // Set to 1 to randomly choose the first song to play
songs=new Array();

// Add song URLs here
songs[0]="SONG URL HERE";
songs[1]="SONG URL HERE";
songs[2]="SONG URL HERE";
songs[3]="SONG URL HERE";
songs[4]="SONG URL HERE";

if (shuffle == 1) {
var randsg = Math.floor(Math.random()*songs.length);
document.darkplayer.FileName = songs[randsg];
document.darkplayer.scr = songs[randsg];
document.forms['form'].playlist.options[randsg].selected = true;
}
function play(list) {
if (playstate == 2) {
document.darkplayer.Play();
} else {
var snum = list.options[list.selectedIndex].value
document.darkplayer.FileName = songs[snum];
document.darkplayer.scr = songs[snum];
}
playstate = 1;
}
//-->
</script>
<!-- end code provided by createblog.com -->

You will need to paste your song info (artist and song title) and song URLs in the appropriate places.

-------------------------------

ADDING MUSIC
In order to add more songs to your playlist, you will need to add an additional

<option value="5">Artist Name - Song Title</option>

and an additional

songs[5]="SONG URL HERE";

And of course increment the value="#" and songs[#] as you go.

-------------------------------

FIND MUSIC
There are various music sites you can pick up song URLs from. Try A__music__X.

-------------------------------

CHANGING STYLES (COLORS)
If you wanted to change the style (colors, font, etc) of the drop down list and play button, use the following codebox and edit it to match your xanga. Paste this into your custom header or within your CSS Style Sheets if you have one already.


<!-- begin code provided by createblog.com -->
<style type="text/css">
select{
color:#000000;
background-color:#FFFFFF;
font-family:arial;
font-size:10px;
}
input {
color:#000000;
background-color:#FFFFFF;
font-family:arial;
font-size:10px;
}
</style>
<!-- end code provided by createblog.com -->

[[i] 本帖最後由 [kae′] 於 2006-8-17 11:40 PM 編輯 [/i]]

頁: [1]


Powered by Discuz! Archiver 5.5.0  © 2001-2006 Comsenz Inc.