Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11508

SharePoint 2010 User Control Mouseover JavaScript Sound

$
0
0

I have created a user control for SharePoint 2010. One of the requirements is to play a sound file on mouseover. I have a simple Javascript solution which works in a standard ASP.NET application, but is giving me trouble in SharePoint. The relevant .ascx looks like this:

<div id="divMouse" onmouseover="playclip();" onmouseout="stopclip();">

Content

</div>

<div id="divSound"><bgsound id="sound" loop="false" /></div>

The JavaScript itself is so:

function playclip() {
            document.all['divSound'].src = "/_controltemplates/MyNamespace/MySoundFile.mp3";
    }

Mousing over the div in SharePoint results in the first second or so of the file playing repeatedly, as long as the pointer is in the div. When I place an alert after the above line in the mouseover event, it gets more interesting - if the alert box is left open, the sound file plays to completion. If it is closed, the sound stops instantly - the pointer has to leave the div to click the 'OK' button on the alert box, and the stopclip() code has also been shown to be executing with a second alert box.

I would appreciate anyone's thougts on this, as I am out of ideas, and haven't been able to turn up anything that helps.


Echo Train Nashville TN



Viewing all articles
Browse latest Browse all 11508

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>