Results 1 to 3 of 3

Thread: help deactivate javascript OnMousOver

  1. #1
    Join Date
    Dec 2008
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default help deactivate javascript OnMousOver

    hi all, i am hoping if someone could help me out with my problem here

    help would be really appreciated.

    I got a script written by someone for me and can't reach to him anymore and I need this to be fixed.

    the problem is that the script works when the page is loaded so when i try to visit a link the url will automaticly go into the player.

    If possible i would like to activate the javascript onMouseOver="init()" and deactivate it onMouseOut="clear()"

    example <a href="#" onMouseOver="init()" onMouseOut="clear()"></a> or in a <div>

    JavaScript
    =========================
    radio.js
    =========================
    Code:
    	window.onload = init();
    		function init () {
    			var x = document.getElementsByTagName ('a');
    			for (i = 0; i < x.length; i++) {
    				x[i].onclick = function () {
    					document.getElementById('below').innerHTML = "<embed type='application/x-mplayer2' id='music2' pluginspage='http://www.microsoft.com/Windows/MediaPlayer/' src='"+ this.href +"' name='MediaPlayer1' width='217' height='84' controltype='1' showcontrols='1' showstatusbar='0' AutoStart='true'></embed> ";
    					return false;
    				}
    			}
    		}
    HTML
    ======================
    index.html
    ======================
    Code:
    <a href="mms://strm-4.us.media.tv/KRALFM_64?MSWMExt=.asf" onMouseOver="init()" onMouseOut="clear()"></a>     
    <embed
    			type="application/x-mplayer2"
    			id="MediaPlayer1"
    			pluginspage="http://www.microsoft.com/Windows/MediaPlayer/"
    			src=""
    			name="MediaPlayer1"
    			controltype="1"
    			showcontrols='1' 
    			showstatusbar="0"
    			autostart="1"
    			height="84"
    			width="217" /> </embed>
    Last edited by turkiyem.fm; 12-20-2008 at 06:16 PM.

  2. #2
    Join Date
    Jun 2008
    Posts
    589
    Thanks
    13
    Thanked 54 Times in 54 Posts
    Blog Entries
    1

    Question

    Code:
    window.onload = init();
    function init () {
        var x = document.getElementsByTagName ('a');
        for (i = 0; i < x.length; i++) {
            x[i].onclick = function () {
                document.getElementById('below').innerHTML = "<embed type='application/x-mplayer2' id='music2' pluginspage='http://www.microsoft.com/Windows/MediaPlayer/' src='"+ this.href +"' name='MediaPlayer1' width='217' height='84' controltype='1' showcontrols='1' showstatusbar='0' AutoStart='true'></embed> ";
                return false;
            }
        }
    }
    
    function clear() {
        var x = document.getElementsByTagName ('a');
        for(i = 0; i < x.length; i++) {
            x[i].onclick = function () {
                document.getElementById('below').innerHTML = "";
                return false;
            }
        }
    }
    Your post and code is very hard to understand. Just by inference, I made the .js have a function that you want. The 'onclick' handler you put in the code will most likely flag a compatibility error in differing browsers. I'll leave it like that for now. As for later, you may want to look into the "attachEvent" or "attachEventHandler" [<- is that correct?] attributes. Your HTML just wasn't working either:

    Code:
    <a href="mms://strm-4.us.media.tv/KRALFM_64?MSWMExt=.asf" onMouseOver="init()" onMouseOut="clear()"></a> 
    <span id="below"></span>
    I'm really lost. Please provide some more clarification so that we can help you out.

    -magicyte

  3. #3
    Join Date
    Dec 2008
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thnx for your response magicyte, i tryed your script didn't work. my javascript knowledge is below the basics =/..eh..

    yeah the url I gave is broken sorry, i got a new link mms://94.75.222.9/PowerTurk,

    ..I try to explain it again.
    this one guy wrote a script for me

    radio.js
    =========================
    //javascript
    Code:
    window.onload = init();
    		function init () {
    			var x = document.getElementsByTagName ('a');
    			for (i = 0; i < x.length; i++) {
    				x[i].onclick = function () {
    					document.getElementById('below').innerHTML = "<embed type='application/x-mplayer2' id='music2' pluginspage='http://www.microsoft.com/Windows/MediaPlayer/' src='"+ this.href +"' name='MediaPlayer1' width='217' height='84' controltype='1' showcontrols='1' showstatusbar='0' AutoStart='true'></embed> ";
    					return false;
    				}
    			}
    		}
    index.html
    ==========
    //embed Mediaplayer in html
    Code:
    <a href="mms://94.75.222.9/PowerTurk" ><div>image</div></a>
    
    <div id="below">
                 <div id="mediaplayer" align="center">
                    <embed
                            type="application/x-mplayer2"
                            id="MediaPlayer1"
                            pluginspage="http://www.microsoft.com/Windows/MediaPlayer/"
                            src=""
                            name="MediaPlayer1"
                            controltype="1"
                            showcontrols='1' 
                            showstatusbar="0"
                            autostart="1"
                            height="84"
                            width="217" ></embed>
                  </div>
    </div>
    only problem is that it gets loaded or activated together with your site. now i tried to adjust it a bit so that the script gets activated when clicked on or with MouseOver.
    So I deleted the first line
    Code:
    window.onload = init();
    after that i made the following link to activate the javascript manually to by hovering over a link
    Code:
    <a href="mms://94.75.222.9/PowerTurk" onMouseOver="init()" ><div>image</div></a>
    by fixing 1 problem I created another problem =/
    the problem is that all the other links when clicked on the window gets send to the embed mediaplayer like http://www.google.nl.

    I just want that when I click on http://www.google.nl I go to the google page and when I click on radio link, it gets loaded by the embed mediaplayer on my site
    Last edited by turkiyem.fm; 12-20-2008 at 06:54 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •