SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru moonman's Avatar
    Join Date
    Dec 2000
    Location
    The Sea of Tranquility
    Posts
    696
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Change button functions

    Ok, I've had a stab at this already, and my JavaScript leaves a bit to be desired, so I need help from the experts.

    I've inlcuded a movie for client on this site. Basically, when the movie is playing, I need to disable the play button, and when the movie is stopped I need to disable the pause button.

    Can someone help me???

    Please!!!

  2. #2
    SitePoint Zealot
    Join Date
    Feb 2002
    Location
    UK
    Posts
    146
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    basically you just need to change the value of document.myButtons.btnPause.disabled to either 1 or 0.

    a simple way would be something like this:
    Code:
    function vidPlay(){
    	document.MediaPlayer1.Play();
    	document.myButtons.btnPause.disabled=0;
    }
    
    function vidStop()
    {
    	document.MediaPlayer1.Stop();
    	document.myButtons.btnPause.disabled=1;
    }
    
    function init()
    {
    	document.myButtons.btnPause.disabled=1;
    }
    and then in the body:
    Code:
    <INPUT NAME="btnPlay" TYPE="Button" VALUE="Play" onclick="vidPlay();">
    <INPUT NAME="btnPause" TYPE="Button" VALUE="Pause" onclick="document.MediaPlayer1.Pause();">
    <INPUT NAME="btnStop" TYPE="Button" VALUE="Stop" onclick="vidStop();">
    run init() on load to initially disable the button.

    There's probably a better way of doing this, perhaps using the PlayState variable

    ...but i hope this helps anyway

  3. #3
    SitePoint Guru moonman's Avatar
    Join Date
    Dec 2000
    Location
    The Sea of Tranquility
    Posts
    696
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You are a genius martm. Thank you very much


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
  •