www.webdeveloper.com
Results 1 to 3 of 3

Thread: add remove innerhtml helllppppp

  1. #1
    Join Date
    Nov 2008
    Posts
    16

    add remove innerhtml helllppppp

    Hello all,this is my code:
    i want when i call the whatever function to show a message in valDiv place...
    i made this...but i want before showing this message to delete the previous message if exist...
    how can i do that...the problem i think is in function remove_show_message...
    any ideas?or how else can be done this???
    PHP Code:
    function whatever(){
    ....
    ....
    ....
    ....
    ....
    remove_show_message();
    show_message(errors);

    PHP Code:
    function show_message(errors) {
      var 
    ni document.getElementById('valDiv');
      
    //var numi = document.getElementById('thevalValue');                       this line may not be important
      //var num = (document.getElementById('thevalValue').value -1)+ 2;     this line may not be important
      //numi.value = num;                                                                    this line may not be important
      
    var newdiv document.createElement('div');
      
    //var divIdName = 'my'+num+'Div';                                                  this line may not be important
      //newdiv.setAttribute('id',divIdName);                                             this line may not be important
      
    newdiv.innerHTML errors;
      
    ni.appendChild(newdiv);
    }
    function 
    remove_show_message() {
        
    XXXXXXXX     //which would be the code here????


    HTML Code:
    <input type="hidden" value="0" id="thevalValue"/>
    <div id="valDiv"></div>
    Last edited by d_psim; 03-19-2009 at 12:19 PM.

  2. #2
    Join Date
    May 2006
    Location
    Odenton, MD
    Posts
    1,449
    i'm assuming you want to clear any present message or content in div valDiv. if so, you can use this simple line:
    Code:
    var div = document.getElementById('valDiv');
    while(div.firstChild)div.removeChild(div.firstChild);
    my mom is javascript, dad is javascripter, granpa is javascriptor, and my little sister is javasRidiculous.
    my nature language is javascript, then come spanish and english -- me

  3. #3
    Join Date
    Nov 2008
    Posts
    16
    thnx mannnnnnn

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