Web Hosting Forum | Lunarpages

Author Topic: SHTML and MP3 mouse over sounds  (Read 43992 times)

Offline I-nead-help-asap-please

  • Newbie
  • *
  • Posts: 1
SHTML and MP3 mouse over sounds
« on: December 05, 2011, 11:13:11 AM »
Anyway to the subject that is bugging the hell out of me. :?

I am trying to use SHTML as my sites all use it. As it is normal html with a few tweaks, I don't normally have problems, but this is bugging the hell out of me. I have just upgraded to Expression and enjoying it... well I was to I hit this problem. lol

Ok, I have opted to remove more and more flash from my sites as I hate it, so using HTML5 now more and more. But I want to add sound to a link, so when a mouse runs over it, it will play a sound. On face of it simple code....

<script>var html5_audiotypes={"mp3": "audio/mpeg","mp4": "audio/mp4","ogg": "audio/ogg","wav": "audio/wav"} function archive(sound){var html5audio=document.createElement('audio') if (html5audio.canPlayType){for (var i=0; i<arguments.length; i++){var sourceel=document.createElement('source')    sourceel.setAttribute('src', arguments) if (arguments.match(/\.(\w+)$/i)) sourceel.setAttribute('type', html5_audiotypes[RegExp.$1]) html5audio.appendChild(sourceel)} html5audio.load() html5audio.playclip=function(){html5audio.pause() html5audio.currentTime=0 html5audio.play()   }return html5audio}else{return {playclip:function(){throw new Error("Your browser doesn't support HTML5 audio unfortunately")}}}} var archive=archive("back.ogg", "back.mp3")
var archive=archive("back.ogg", "back.mp3")</script>

Then add...

<a title="Go at back  please." href="http://www.site.html" onmouseover="archive.playclip()"><font color="#000000">
               <span style="text-decoration: none; font-weight:700">I want to go back</span></font></a>

 It plays, but problem is the clip is not in the same folder.    It is say in http://www.site.html/soundsinhere/ and not in the main laning area http://www.site.html    How do you get the scrip to load the sound from  http://www.site.html/soundsinhere/ and not http://www.site.html?    Also say if the sound is on http://www.antherwebsite.html  how do you tell it to be pulled from that site?

Any ideas???   I know it will be easy fix, but cant work it out and it is getting me fed up!  I would put down 8 other scripts and way I have tried to do this, but pointless in my view as all fail...  

The script is in a header that is in another location and the body in another folder...

It runs the header by calling up from the main body as a standerd shtml include.

<!--#INCLUDE VIRTUAL="/soundsinhere/sound-header.htm"-->


<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

<!--#INCLUDE VIRTUAL="/soundsinhere/sound-header.htm"-->


This is the page


Any ideas welcome....  I know I am loosing the plot with this idea...    duh  I could normally fix this, but at this point... lol    :-?

« Last Edit: December 05, 2011, 11:20:59 AM by I-nead-help-asap-please »


Share |