Trying to create a switch that allows me to change text back and forth

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dfluker
    New Member
    • Feb 2010
    • 10

    Trying to create a switch that allows me to change text back and forth

    Here is my code:<title>Dom demo</title>
    <script type="text/javascript">
    function changeText()

    {

    var Temp = document.getEle mentById('first ').innerHTML= 'Second Entry';

    document.getEle mentById('secon d').innerHTML= 'First Entry';

    document.getEle mentById('Temp' ).value;

    }

    </script>
    </head>
    <body>

    <div id="first">Firs t Entry</div>
    <div id="second">Sec ond Entry</div>
    <input type="button" onclick="change Text()" value="Change text of this document">
    </body>
    </html>


    It displays:

    First Entry
    Second Entry

    I press a radio button that makes it do this

    Second Entry
    First Entry

    But I don't know how to make it go back to :

    First Entry
    Second Entry:

    I am knew to this stuff can someone help?
  • drhowarddrfine
    Recognized Expert Expert
    • Sep 2006
    • 7434

    #2
    This is a javascript question for the javascript board.

    Comment

    • dfluker
      New Member
      • Feb 2010
      • 10

      #3
      Sorry, my mistake, I think I'm on the right board now.

      Comment

      • johny10151981
        Top Contributor
        • Jan 2010
        • 1059

        #4
        document.getEle mentById('first ').innerHTML may be this is wrong.
        innerHtml
        Last edited by johny10151981; Feb 9 '10, 03:32 AM. Reason: mislead info :)

        Comment

        Working...