Solved

CGI for Midis?

Posted on 1998-02-12
1
248 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Interactive Way of Training for the AWS CSA Exam

An interactive way of learning that will help you visualize core concepts so that you can be more effective when taking your AWS certification exam.  Built for students by a student to help them understand the concepts that they are being taught.

Question has a verified solution.

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

Making a simple AJAX shopping cart Couple years ago I made my first shopping cart, I used iframe and JavaScript, it was very good at that time, there were no sessions or AJAX, I used cookies on clients machine. Today we have more advanced techno…
Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

624 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