Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UGLY JAVASCRIPT

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I am doing my 2nd webpage,so i'm not a newbie...
I want to add some script to it...
I want to make a script that will do that:
When you putting mouse over link/image(Onmouseover)
it changes(Image)+sound plays once.
PLZ,HELP...I need a script or a hint...
Sincerity,Serge
 
Hi Serge,

I have not working with sounds and javascript,but I guess you should try something like this:

<html>
<head>
<script>
<!--
image1=new Image(100,100);
image1.src='picture1.jpg';
image2=new Image(100,100);
image2.src='picture2.jpg';
//-->
</script>
</head>
<body>
<embed src=&quot;mysoundfile.wav&quot; hidden=&quot;true&quot; autostart=&quot;false&quot; loop=&quot;false&quot; name=&quot;mysound&quot;>
<a href=&quot;mypage.htm&quot; onmouseover=&quot;document.mysound.play ();document.mypicture.src=image2.src&quot; onmouseout=&quot;document.mysound.stop();document.mypicture.src=image1.src&quot;>
<img src=&quot;picture1.jpg&quot; name=&quot;mypicture&quot;>
</a>
</body>
</html>



This would play 'mysoundfile.wav' onmouseover and stop playing the sound onmouseout,and at the same time would change the images.In the example they are 100x100 px.

I tested the sound part in IE+ but I'm not sure if this works out in NN.

I hope this helps.I'm just trying to help.

Kindest Regards

alexfusion
 
Hi Serge,

You are very welcome.Anything I can do for you,I'll try to to my best.

Kindest Regards

alexfusion
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top