SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Addict
    Join Date
    Jan 2005
    Location
    Paris
    Posts
    370
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Changing Text Button on the fly...

    I have a script that create a button on the fly with JS... actually a table with diffierent button i want to change the text onclick whenever a user click on one of them....

    Code JavaScript:
    // Insertion d'une colonne contenant le Boutton de Suppression 
                    			var celluleButton = document.createElement("td");
                 				celluleButton.id = 'celluleButton';
       							celluleButton.innerHTML = '<input type="button" id="button_selected" name="sl_json_selected_' +SmartLink.id_source+ '" value="Supp" onclick="suppLienCible()">';
       							cell2DisplayLine.appendChild(celluleButton);

    i have tried this but doesn't work

    Code JavaScript:
    function suppLienCible()
    {
    document.getElementById.value('button_selected') = 'Retablir';
    return true;
    }
    On a PHP/Java/XML/Javascript/MySQL internship right now!

  2. #2
    SitePoint Wizard gRoberts's Avatar
    Join Date
    Oct 2004
    Location
    Birtley, UK
    Posts
    2,439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    close

    Code:
    function suppLienCible()
    {
        document.getElementById('button_selected').value = 'Retablir';
        return true;
    }


  3. #3
    SitePoint Addict
    Join Date
    Jan 2005
    Location
    Paris
    Posts
    370
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thnak you it works fine!
    On a PHP/Java/XML/Javascript/MySQL internship right now!

  4. #4
    SitePoint Addict
    Join Date
    Jan 2005
    Location
    Paris
    Posts
    370
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Knowing that there are between a minimum of two to 6 of those buttons in the table what kind of attributes i have to give to the button so the only one to react at the onclick function is the one that has been clicked on and if the adjacent cell to those buttons there is a text that has to change its text-decoration for example... how do i insure that the only text to be lined-through is the one actually adjacent to the button i just clicked on?
    On a PHP/Java/XML/Javascript/MySQL internship right now!


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
  •