Results 1 to 2 of 2

Thread: Changing variables for currentElement.firstChild.data

  1. #1
    Join Date
    Jun 2011

    Exclamation Changing variables for currentElement.firstChild.data

    I am working on a script that allows a link's text to be changed from Show Video to Hide Video and back. However, I can't get this to work, as it changes but won't change back. My script:

    HTML Code:
    <script language="javascript"> 
    // I wrote this.  The alert is to see if the var changes.
    var chText = "Hide Video"
    function change(){
    if (chText == "Hide Video") {
    var chText = "Show Video";
    else {
    var chText = "Hide Video";
    <script language="javascript">
    //Not mine. It works fine.
    function changeText(currentElement){
    <a href="#" onclick="change(), changeText(this)">Show Video</a>

  2. #2
    Join Date
    Jul 2008
    urbana, il
    is data r/w?
    what's up with minute dom methods for text?

    just use element.innerHTML dude, nodes are a headache.
    Create, Share, and Debug HTML pages and snippets with a cool new web app I helped create: pagedemos.com

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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