SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2006
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    error with innerhtml

    why this not works?
    document.getElementById("casella"+i).innerHTML="<input type='button' name='"+etichetta_bottone+"' id='"+etichetta_bottone+"' onclick=""form.data_fine.selectedIndex='0';form.data_inizio.selectedIndex='0';form.giorno_settimanale.selectedIndex='0';mese_giorno(document.getElementById('form'),'"+etichetta_bottone+"');"" style='width:20px;height:15px;margin 0 auto;padding:0px;margin:0px;font-size:11px;border:0px;background-color:#FFFFFF' value='"+i+"'>";

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,508
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    You must escape the double quotes around the onclick string, not write them 2 times: \" instead of ""

    Code:
    document.getElementById("casella"+i).innerHTML="<input type='button' name='"+etichetta_bottone+"' id='"+etichetta_bottone+"' onclick=\"form.data_fine.selectedIndex='0';form.data_inizio.selectedIndex='0';form.giorn o_settimanale.selectedIndex='0';mese_giorno(document.getElementById('form'),'"+etichetta_bottone+"');\" style='width:20px;height:15px;margin 0 auto;padding:0px;margin:0px;font-size:11px;border:0px;background-color:#FFFFFF' value='"+i+"'>";


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
  •