Solved

CGI for Midis?

Posted on 1998-02-12
1
244 Views
Last Modified: 2013-12-25
I would like to have a random midi play on my webpage when someone visits it.  Is there a cgi out there or someway to do this?
0
Comment
Question by:treyjeff
1 Comment
 

Accepted Solution

by:
cfrericks earned 50 total points
ID: 1831985
you don't need to use cgi to do this.  A simple javascript will do this for you.  here it is:



<SCRIPT LANGUAGE="JavaScript">
var theurl = document.location
if (theurl == "put your page address here where you will use the midi randomizer") {
   
song = new Array(10);

song[0] ='m/first song title name.mid'
song[1] ='m/second song title name.mid'
song[2] ='m/third song title name.mid'
song[3] ='m/fourth song title name.mid'
song[4] ='m/fifth song title name.mid'
song[5] ='m/sixth song title name.mid'
song[6] ='m/seventh song title name.mid'
song[7] ='m/eighth song title name.mid'
song[8] ='m/ninth song title name.mid'
song[9] ='m/tenth song title name.mid'
song[10] = 'm/eleventh song title.mid'


index = Math.floor(Math.random() * song.length);document.write("<DL>\n");
document.write("<EMBED SRC="+song[index]+" width=200 height=55 autostart=true loop=infinite BGCOLOR='enter background color'");
document.write("</DL>\n");
}
else{}
</SCRIPT>

to add more songs to the randomizer change the song = new array to the appropriate number and duplicate the song [number] thing.
This script goes between the head tags of your homepage.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question