Playing a MIDI file without seing MediaPlayer

When a MIDI file is selected as background you don't see MediaPlayer; however when you Click on a MIDI file it is played with MediaPlayer appearing.

How can you prevent this ?
PhLAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
messentaryConnect With a Mentor Commented:
OK, to get the hand, change the code to this:

<A href="#midi" onMouseDown="playSnd('file.midi')"><img src="image.gif" name="midi"  height="80" width="80" border="0"></a>

This brings out a hyperlink to the image.  Sort of fooling the browser because the link doesn't really go anywhere.

Now to disable right clicks.  This is a Javascript code that needs to be placed in the <head> tags as well.  Where it says Place message here, place in a message that will pop up instead of the menu:

<script language="JavaScript">

 <!--
// No rightclick script v.2.5
// (c) 1998 barts1000
// barts1000@aol.com
// Don't delete this header!

var message="Place your message here"; // Message for the alert box

// Don't edit below!
function click(e) {
if (document.all) {
if (event.button == 2) {
alert(message);
return false;
}
}
if (document.layers) {
if (e.which == 3) {
alert(message);
return false;
}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;
// -->

</script>

Well, I hope that helps you out.
0
 
rpmodellCommented:
maybe you can put it on a <div> that's hidden? that should do the trick. the questions though is if it's played at all then. give it a shot, i say.
robert.
0
 
PhLAuthor Commented:
Can you explain a little more...
Let say with an example !

Thanks !
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
egbservicesCommented:
I have tried this too some time ago... unsuccessfully though! But by now I have learned that midi or wav files are not really such a great hit on a site, especially when you dont give the visitor the option to turn it off. I use background sound am continously reminded by visitors to play them only once or not at all... :-(
This is not ment to be a critisism but rather a little part of my own experience creating wep pages. Edi
0
 
messentaryCommented:
you can use an onMouseDown action.  Place your code and I'll place in the onMouseDown code if you need it.

Or you can use a small console with an <EMBED> tag.
0
 
PhLAuthor Commented:
1. I know quite nothing about HTML so could you please give an example ?

2. I made a very low volume background with only accoustic guitar

3. The other MIDI are my compositions so I would like other people to hear them...
0
 
messentaryCommented:
OK, here is a mouseOver event using an image as the href.  To use text, just replace the <img src> tag with text.:

This is for Mouse click:

Place this within the <head> tags:

<SCRIPT>
function playSnd(sndName)  {
     snd1.src = sndName;
}
</SCRIPT>
<BGSOUND id=snd1>

Now place this where your image is:

<A onMouseDown="playSnd('file.midi')"><img src="image.gif" height="80" width="80" border="0"></a>

Give it a try, and let me know how it goes.

0
 
PhLAuthor Commented:
It seems OK !
Some help still needed...

1.  Front Page Express doesn't allow to type (or save) what you say so I have to go to Notepad to try !

2.  I replace your image by a text.

3.  How to get a hand with finger up instead of the carret (or another symbol like a note) when I go upon the text ?

4.  How can I enable only Left Mouse Button ?

0
 
PhLAuthor Commented:
Once more a great answer !

1.  What do I need to do before using a copyrighted JavaScript ?

2.  The script did noy prevent the play of a song when you Right Click...

3.  Will all this work on any browser or only ie5 ?

0
 
messentaryCommented:
to use a copyroghted Javascrupt, just leave the header in there that mentions the writer of it.

The reason the file played on right click was because the javascript is looking for a mouse click.  The xcript I sent you will only disable the right click menu function.  you cannot completely disable the mouseclick or else the midi file wont play.

It will work in both browsers.

Easy enough.

M

0
 
PhLAuthor Commented:
You mean ie4 and ie5 or
MS and Netscape ?

0
 
messentaryCommented:
IE4, IE5, Netscape4
0
All Courses

From novice to tech pro — start learning today.