Forum Moderators: open

Message Too Old, No Replies

embed src for "click .gif for sound"?

html sound embed src

         

porqpyn

11:12 pm on Feb 16, 2004 (gmt 0)

10+ Year Member



I need the embed src for clicking on an image to start a sound file. I don't mean the A HREF= link to the sound file, but the sound starting when the image is clicked without the page changing.

thehittmann

6:33 am on Feb 17, 2004 (gmt 0)

10+ Year Member



I dont think you can do that with html, I know that you can using java or flash though.

keyplyr

9:07 am on Feb 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month




Try this:

<a onClick="window.status=''; return false;" href="path_to_sound.file"><img src="image.file"></a>

porqpyn

3:13 pm on Feb 17, 2004 (gmt 0)

10+ Year Member



Thanks, but it doesn't work. I saw the "click-pic for sound" work a few years ago, but I didn't copy the URL. I did go to the source and get the code:

<A HREF="----.mid"> <IMG SRC="----.gif" WIDTH= HEIGHT= BORDER= ></A>

This started the sound. I tried it yesterday, but it turned out to be a link. I know I saw it work correctly otherwise I would not have copied it down.

I'd rather use HTML, but what do I seach for as far as JS is concerned?

keyplyr

7:10 pm on Feb 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I guess I do not understand what you are seeking here. A standard link attached to an image will start your sound file. What else are you after?

porqpyn

10:43 pm on Feb 17, 2004 (gmt 0)

10+ Year Member



I want the midi to start playing when the image is clicked, without the page changing. I tried what you gave me. The page remained the same, but there was no sound.

keyplyr

12:26 am on Feb 18, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month




I tried what you gave me... but there was no sound

Try again, you must have made an error in your code or there is a problem with your sound file, the path, or possibly your player. I use this code all the time.

porqpyn

5:08 pm on Feb 18, 2004 (gmt 0)

10+ Year Member



This is how I put it on my site. I did not add anything to "window.status='';

<a onClick="window.status=''; return false;" href="bergeret.mid"><img src="00/xArc1.jpg"></a>

This adds a thin blue border around the image that turns red with the mouseover. But when I click the image nothing happens.

keyplyr

7:19 pm on Feb 18, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



porqpyn - This is one of the hazzards of cut 'n pasting code.

<a onClick="window.status=''; return false;" href="path_to_sound.file"><img src="image.file"></a>

Those are 2 single quotes that follow status=

<added>

The onClick="window.status=''; return false;" part should make the page remain steady while the MIDI file is played, but it is not really necessary. You should be able to play your file just fine with:


<a href="bergeret.mid"><img src="00/xArc1.jpg"></a>

What happens that you don't like?

porqpyn

7:50 pm on Feb 19, 2004 (gmt 0)

10+ Year Member



One more try.
I have a test page set up if you'd like to go see it:
[geocities.com...]
There are two images with the different codes and the midi itself.
Thanks for your help.

keyplyr

9:23 pm on Feb 19, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Image # 1. This is the "on Click = "window . status = " etc.
This doesn't work at all.

You still need to change those quotes

Image # 2. This is the a href = midi followed by the img src =. This is a link to the midi file. This changes the page. I want to click on the image and have the music play instantly without the page changing.

The page didn't "change" for me. I tested with IE6.

zoobie

5:54 am on Feb 23, 2004 (gmt 0)

10+ Year Member



The bottom image worked fine for me in IE6.
You got something else wrong somewhere if you can't hear it. Maybe you're missing the midi plugin. I use audio files all the time. Take all that window.status javacrap out and just use:
<a href="song.mid"><img src="cat.gif"></a>
Btw, I wouldn't use midi...sounds like a cheap $10 keyboard...probably because it is. }:^)