Results 1 to 4 of 4

Thread: Change a span id, not rewrite the page?

  1. #1
    Join Date
    Oct 2010

    Angry Change a span id, not rewrite the page?

    Hi all you brill javascripters, I have a problem (obviously) I have a Div with a couple of spans to control a music file, onload the music file plays with a "Pause Music" link in control.

    <span id="MusicOn" class="Music" OnClick="document.all.MusicOff.style.display='inline'; MusicOn.style.display='none'; javascript:document.getElementById('music').Play(); setTimeout('PlayButton()',15000);">Play Music</span id="MusicOn">

    <span id="MusicOff" class="Music" OnClick="document.all.MusicOn.style.display='inline'; MusicOff.style.display='none'; javascript:document.getElementById('music').Stop();">Pause Music</span id="MusicOff">

    After 15 seconds the music will be finished and I want to replace the pause link with a play link, the "PlayButton" javascript uses a setTimeout and a document.write control which obviously runs but clears the html page and I need to add/change the current page.
    Anybody with any help would be appreciated.

  2. #2
    Join Date
    Apr 2010
    You'll need to post an example of the script itself.

  3. #3
    Join Date
    Oct 2010


    Der, Sorry,

    The script -

    function PlayButton()
    output = "self"
    output.write("<span id=\"MusicOn\" class=\"Music\" OnClick=\"document.all.MusicOff.style.display='inline'; MusicOn.style.display='none'; javascript:document.getElementById('music').Play(); setTimeout('PlayButton()',15000);\">Play Music</span id=\"MusicOn\">")

    Obviously I have tried document.write but get a new page.

  4. #4
    Join Date
    Oct 2010
    Versailles, France

    Walking through the DOM tree...

    It's strange to repeat the id with the closing tag ? See this page

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Recent Articles