innerHTML不适用于JavaScript

时间:2014-01-03 11:14:32

标签: javascript

代码中有错误,但我看不到哪里,有某些ID不起作用。

这是我的代码,我在之前填写页面的cookie中写入数据。我检查了cookie是否包含正确的数据并且所有数据都是正确的 下面的代码是JavaScript代码。

   var coockie = getCookie("cursus") ;

   document.getElementById("cookie-extra-zin").innerHTML = getCookie("extra-zin");
   document.getElementById("cookie-meervoud").innerHTML = getCookie("meervoud");
   document.getElementById("cookie-meervoud2").innerHTML = getCookie("meervoud");
   document.getElementById("cookie-naam").innerHTML = getCookie("voornaam") + " " + getCookie("achternaam");
   document.getElementById("cookie-opleidingcheques-kader").innerHTML =     getCookie("opleidingcheques");
   document.getElementById("cookie-kmoportefeuille-kader").innerHTML = getCookie("kmoportefeuille");
   document.getElementById("cookie-prijs-kader").innerHTML=  getCookie("prijs");
   document.getElementById("cookie-cursus-kader").innerHTML = getCookie("cursus");
   document.getElementById("cookie-extra-cursus-kader").innerHTML = getCookie("extra-cursus-kader");
   document.getElementById("cookie-studieduur-kader").innerHTML = getCookie("studieduur");
   document.getElementById("cookie-prijs").innerHTML = getCookie("prijs");
   document.getElementById("cookie-koren").innerHTML = getCookie("koren"); 
   document.getElementById("cookie-cursus").innerHTML = getCookie("cursus");
   document.getElementById("cookie-promo").innerHTML = getCookie("promocode");
   document.getElementById("cookie-campus").innerHTML = getCookie("campus");
   document.getElementById("cookie-campus2").innerHTML = getCookie("campus");
   document.getElementById("cookie-startdatum").innerHTML = getCookie("startdatum");
   document.getElementById("cookie-startdatum2").innerHTML = getCookie("startdatum");

这是HTML代码:

    </span><span id="cookie-extra-cursus-kader"></span></font>
    <ul>
        <li>Lesgeld: <span id="cookie-prijs-kader"></span> euro</li>
        <li>Voor iedereen: ja</li>
        <li>Studieduur: <span id="cookie-studieduur-kader"></span> mnd</li>
        <li>Erkend diploma: ja</li>
        <li>Opleidingscheques: <span id="cookie-opleidingcheques-kader"></span></li>
        <li>KMO-portefeuille: <span id="cookie-kmoportefeuille-kader"></span></li>
    </ul>

这是cookie的数据:

  if (document.getElementById('voornaam')) {
  setCookie("voornaam", document.getElementById("voornaam").value); 
  }
  //if (document.getElementById('ExtraCursus')) {
  //setCookie("extra-cursus-kader", "");
  //}
  if (document.getElementById('achternaam')) {
  setCookie("achternaam", document.getElementById("achternaam").value); 
  }
  if (document.getElementById('email')) {
  setCookie("email", document.getElementById("email").value); 
  }
  if (document.getElementById('telefoonnummer')) {
  setCookie("telefoonnummer", document.getElementById("telefoonnummer").value);  
  }
  if (document.getElementById('straat')) {
  setCookie("straat", document.getElementById("straat").value); 
  }
  if (document.getElementById('huisnummer')) {
  setCookie("huisnummer", document.getElementById("huisnummer").value); 
  }
  if (document.getElementById('postcode')) {
  setCookie("postcode", document.getElementById("postcode").value); 
  }
  if (document.getElementById('woonplaats')) {
  setCookie("woonplaats", document.getElementById("woonplaats").value); 
  }
  if (document.getElementById('land')) {
  setCookie("land", document.getElementById("land").value); 
  }
  if (document.getElementById('geboortedatum')) {
  setCookie("geboortedatum", document.getElementById("geboortedatum").value); 
  }
  if (document.getElementById('cursus')) {
  setCookie("cursus", document.getElementById("cursus").value); 
  }
  if (document.getElementById('campus')) {
  setCookie("campus", document.getElementById("campus").value); 
  }
  if (document.getElementById('startdatum')) {
  setCookie("startdatum", document.getElementById("startdatum").value); 
  }
  if (document.getElementById('koren')) {
  setCookie("koren", document.getElementById("koren").value); 
  } 
  if (document.getElementById('v_pagina')) {
  setCookie("pagina", document.getElementById("v_pagina").value); 
  } 
  if (document.getElementById('prijs')) {
  setCookie("prijs", document.getElementById("prijs").value); 
  }
  if (document.getElementById('v_studieduur')) {
  setCookie("studieduur", document.getElementById("v_studieduur").value); 
  }
  if (document.getElementById('v_opleidingcheques')) {
  setCookie("opleidingcheques", document.getElementById("v_opleidingcheques").value); 
  } 
  if (document.getElementById('v_kmoportefeuille')) {
  setCookie("kmoportefeuille", document.getElementById("v_kmoportefeuille").value); 
  }
  if (document.getElementById('v_school')) {
  setCookie("school", document.getElementById("v_school").value); 
  }
  if (document.getElementById('v_dl')) {
  setCookie("download-link", document.getElementById("v_dl").value); 
  }
  if (document.getElementById('v_vroegboekkorting')) {
  setCookie("vroegboekkorting", document.getElementById("v_vroegboekkorting").value); 
  }
  if (document.getElementById('v_vroegboekkortingspercentage')) {
  setCookie("vroegboekkortingspercentage",       document.getElementById("v_vroegboekkortingspercentage").value); 
  }
  if (document.getElementById('v_vroegboektotaal')) {
  setCookie("vroegboektotaal", document.getElementById("v_vroegboektotaal").value); 
  }
  if (document.getElementById('v_vroegboektotaal')) {
  var url = window.location.search;
  setCookie("urlquerystring", url); 
  document.getElementById("v_querystring").value = url ; 
  }
  if (document.getElementById('extra-zin')) {
  setCookie("extra-zin", document.getElementById("extra-zin").value); 
  } 
  if (document.getElementById('meervoud')) {
  setCookie("meervoud", document.getElementById("meervoud").value); 
  }

来自cookie的数据来自这些div:

    <form name="frmSS313" id="frmSS313" class="form" action="http://www.ondernemerschool.com/news/form.php?form=313" method="post" onSubmit="return CheckForm(this);">
    <table style="font-size: 12px;" cellspacing="5" width="570">
    <tbody>
    <tr>
    <td width="175" style="text-align:left" align="left" valign="bottom">       <strong><label for="voornaam">Voornaam + </label><label for="achternaam">naam: <sup>*</sup></label></strong></td>
        <td valign="bottom" style="text-align:left" align="left" colspan="2"><nobr><input type="text" name="CustomFields[16]" id="voornaam" style="width:137px" onKeyUp="toUpper(this)"> <input type="text" name="CustomFields[17]" id="achternaam" style="width:212px" onKeyUp="toUpper(this)"></nobr></td></tr>
    <tr>
    <td width="175" style="text-align:left" align="left" valign="bottom"><strong><label for="email">E-mail adres: <sup>*</sup></label></strong></td>
        <td valign="bottom" colspan="2" style="text-align:left" align="left"><input type="text" name="email" id="email" style="width:364px"></td>
    </tr>
    <tr>
    <td style="text-align: left;" width="220" align="left" valign="bottom"><strong><label for="telefoonnummer">Telefoonnummer:  <sup>*</sup></label></strong></td>
    <td colspan="2" valign="bottom"><input id="telefoonnummer" name="CustomFields[22]" style="width:364px" type="text" /></td>
    </tr>
    <tr>
    <td style="text-align: left;" width="175" align="left" valign="bottom"><nobr><label for="straat"><strong>Straat + </strong></label><strong><label for="huisnummer">Huisnummer:</label></strong> </nobr></td>
    <td style="text-align: left;" colspan="2" align="left" valign="bottom"><div><nobr><input id="straat" style="width: 295px;" name="CustomFields[18]" type="text" /> <input id="huisnummer" style="width: 54px;" name="CustomFields[35]" type="text" /></nobr></div></td>
    </tr>
    <tr>
    <td style="text-align: left;" width="175" align="left" valign="bottom"><nobr><label for="postcode"><strong>Postcode + </strong></label><strong><label for="woonplaats">Woonplaats:</label></strong>  <label for="CustomFields_20_313"> <sup>*</sup></label></nobr></td>
    <td style="text-align: left;" colspan="2" align="left" valign="bottom">
    <div><nobr><input id="postcode" style="width: 70px;" name="CustomFields[19]" type="text" /> <input id="woonplaats" style="width: 279px;" name="CustomFields[20]" type="text" /></nobr></div></td>
    </tr>
    <tr>
    <td style="text-align: left;" width="175" align="left" valign="bottom"><label for="land"><strong>Land:</strong></label></td>
    <td style="text-align: left;" colspan="2" align="left" valign="bottom"><input id="land" style="width: 364px;" name="CustomFields[21]" type="text" /></td>
    </tr>
    <tr>
    <td style="text-align: left;" width="160" align="left" valign="bottom"><label for="geboortedatum">Geboortedatum:</label></td>
    <td style="text-align: left;" colspan="2" align="left" valign="bottom"><input name="CustomFields[43]" id="geboortedatum" type="text" /> (dd/mm/yyyy)</td>
    </tr>
    <script>
        $(function() {
            $( "#CustomFields_43_313" ).datepicker({
                dayNamesMin: ['Zo', 'Ma', 'Di', 'Wo', 'Do', 'Vr', 'Za'],
                monthNamesShort: ['Jan', 'Feb', 'Maa', 'Apr', 'Mei', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'],
                yearRange: 'c-80:c+10',
                changeMonth: true,
                changeYear: true,
                dateFormat: 'dd/mm/yy'
            });
        });
        </script>

    <tr>
    <td style="text-align: left;" width="175" align="left" valign="bottom"><strong>
    <label for="CustomFields_40_313">Cursus: </label>
    </strong></td>
    <td style="text-align: left;" colspan="2" width="336" align="left" valign="bottom">[urlparam param="cursus" default="" /] <a href="http://www.centrumvoorafstandsonderwijs.be/inschrijven-opleidingen/" style="font-size:10px">(Voor een andere cursus klik hier.)</a></td>
    </tr>
    <tr>
    <td style="text-align: left;" width="160" align="left" valign="bottom"><label for="CustomFields_69_145"><nobr>Promocode:</nobr></label></td>
    <td style="text-align: left;" colspan="2" align="left" valign="bottom"><input name="CustomFields[69]" id="promocode" value="" type="text" /></td>
    </tr><script>
        $(function() {
            $( "#CustomFields_44_313" ).datepicker({
                dayNamesMin: ['Zo', 'Ma', 'Di', 'Wo', 'Do', 'Vr', 'Za'],
                monthNamesShort: ['Jan', 'Feb', 'Maa', 'Apr', 'Mei', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'],
                yearRange: 'c-1:c+2',
                changeMonth: true,
                changeYear: true,
                dateFormat: 'dd/mm/yy'
            });
        });
        </script>
    <!--tr>
    <td style="text-align: left;" width="160" align="left" valign="bottom"><label for="CustomFields_69_313"><nobr>Promocode:</nobr></label></td>
    <td style="text-align: left;" colspan="2" align="left" valign="bottom"><input name="CustomFields[69]" id="promocode" value="" type="text" /></td>
    </tr-->
    <tr>
    <td style="text-align: left; vertical-align: top;" width="175" align="left" valign="top"><strong><div><label for="CustomFields_15_313">Opmerkingen:</label></div></strong></td>
    <td style="text-align: left;" colspan="2" align="left" valign="bottom"><textarea id="CustomFields_15_313" style="width: 364px;" rows="3" name="CustomFields[15]"></textarea></td>
    </tr>
    <tr>
    <td><strong>Factuurgegevens:</strong></td>
    <td><input type="checkbox" value="akkoord" id="checkbox" name="" > Ik wens na betaling een factuur (enkel voor bedrijven)</td>
    </tr>
    <tr id='btw6' class="btw">
    <td><strong>Facturatieadres</strong></td>
    <td><input type="checkbox" value="akkoord" id="checkbox2" name=""  > Mijn facturatieadres is anders dan bovenstaande afleveradres</td>
    </tr>

    <tr id='btw1' class='btw'>
    <td width="175" style="text-align:left" align="left" valign="bottom"><strong><label for="email">Naam bedrijf: <sup>*</sup></label></strong></td>
        <td valign="bottom" colspan="2" style="text-align:left" align="left"><input type="text" name="CustomFields[13]" id="btwbedrijf" style="width:364px"></td>
    </tr>
    <tr id='btw2' class='btw'>
    <td width="175" style="text-align:left" align="left" valign="bottom"><strong><label for="email">BTW nr: <sup>*</sup></label></strong></td>
        <td valign="bottom" colspan="2" style="text-align:left" align="left"><input type="text" name="CustomFields[14]" id="vatnumber" style="width:364px"></td>
    </tr>
    <tr id='btw3' class='btw2'>
    <td style="text-align: left;" width="175" align="left" valign="bottom"><nobr><label for="factstraat"><strong>Straat + </strong></label><strong><label for="facthuisnummer">Huisnummer: <sup>*</sup></label></strong> </nobr></td>
    <td style="text-align: left;" colspan="2" align="left" valign="bottom"><div><nobr><input id="facstraat" style="width: 295px;" name="CustomFields[82]" type="text" /> <input id="fachuisnummer" style="width: 54px;" name="CustomFields[83]" type="text" /></nobr></div></td>
    </tr>
    <tr id='btw4' class='btw2'>
    <td width="175" style="text-align:left" align="left" valign="bottom"><strong><label for="facturatiepostcode">Postcode: <sup>*</sup></label></strong></td>
        <td valign="bottom" colspan="2" style="text-align:left" align="left"><input type="text" name="CustomFields[84]" id="facturatiepostcode" style="width:364px"></td>
    </tr>
    <tr id='btw7' class='btw2'>
    <td width="175" style="text-align:left" align="left" valign="bottom"><strong><label for="facturatiepostcode"><strong>Woonplaats:</strong><sup>*</sup></label></strong></td>
        <td valign="bottom" colspan="2" style="text-align:left" align="left"><input type="text" name="CustomFields[84]" id="facturatieadres" style="width:364px"></td>
    </tr>
    <tr id='btw5' class='btw2'>
    <td width="175" style="text-align:left" align="left" valign="bottom"><strong><label for="facturatieland">Land: </label></strong></td>
        <td valign="bottom" colspan="2" style="text-align:left" align="left"><input type="text" name="CustomFields[86]" id="facturatieland" style="width:364px"></td>
    </tr>

    <td style="text-align: left;" width="175" align="left" valign="top"><strong>Voorwaarden: <sup>*</sup></strong></td>
    <td style="text-align: left;" align="left" valign="bottom" colspan="2"><label for="CustomFields[34_313]"><input type="checkbox" value="akkoord" id="CustomFields[34_313]_akkoord" name="CustomFields[34]" >  Ik ga akkoord met de algemene voorwaarden.</label></td>
    </tr>
    <tr>
    <td style="text-align: right;" align="right" valign="bottom" colspan="3"><a href="http://www.ondernemersschool.be/globals/docs/alg.html" class="fancybox-iframe"><img src="http://www.ondernemersschool.be/globals/docs/algemene-voorwaarden.jpg" width="381" height="101"></a></td>
    </tr>
    </tbody>
    </table>
    <!--table style="font-size: 12px;" cellspacing="5" width="570">
      <tbody>
    <tr>
    <td colspan="3" align="left"><img src="http://www.bedrijfsbeheer.net/wp-content/uploads/2010/12/highlight_indicator.gif" width="10" height="9"><a href="javascript:toggleDisplay();" class="nav"><b>Klik hier om extra informatie in te vullen om je beter van dienst te kunnen zijn.</b></a></td></tr>
    </tbody>
    </table-->
    <!--div id="toggleMe" style="visibility: hidden; display: none;">
    <table style="font-size: 12px;" cellspacing="5" width="570">
    <tbody>
    <tr>
    <td style="text-align: left;" width="175" align="left" valign="bottom"><label for="CustomFields_32_313">Studentennummer:</label></td>
    <td style="text-align: left;" colspan="2" align="left" valign="bottom"><input id="CustomFields_32_313" style="width: 364px;" name="CustomFields[32]" type="text" /></td>
    </tr>
    <tr>
    <td style="text-align: left;" align="left"><label for="CustomFields_36_313">Beroep:</label></td>
    <td style="text-align: left;" colspan="2" align="left"><input id="CustomFields_36_313" style="width: 364px;" name="CustomFields[36]" type="text" /></td>
    </tr>
    <tr>
    <td style="text-align: left;" align="left"><label for="CustomFields_13_313">Bedrijf:</label></td>
    <td style="text-align: left;" colspan="2" align="left"><input id="CustomFields_13_313" style="width: 364px;" name="CustomFields[13]" type="text" /></td>
    </tr>
    </tbody>
    </table>
    </div-->
    <table width="570">
    <tbody>
    <tr>
    <td class="txt" width="140" height="46">
    <div class="submit"><input type="submit" value="Verzenden" /></div></td>
    <td colspan="2" height="46" align="left">
    <div id="error" style="visibility: hidden; font-weight: bold; font-size: 12px; color: #900;"><span style="color: #011a39;"><strong>Gelieve alle verplichte velden juist in te vullen *</strong></span></div></td>
    </tr>
    </tbody>

    </table>
    <div style="display: none; and visibility: hidden;"><input id="CustomFields_33_313" name="CustomFields[33]" type="hidden" value="centrumvoorafstandsonderwijs.be inschrijven TS" />
    <input id="koren" name="CustomFields[40]" type="hidden" value="[urlparam param="opleiding" default="" /]" />
    <input id="cursus" name="CustomFields[58]" type="hidden" value="[urlparam param="cursus" default="" /]" />
    <input id="v_pagina" name="CustomFields[57]" type="hidden" value="[urlparam param="pagina" default="" /]" />
    <input id="prijs" name="CustomFields[56]" type="hidden" value="[urlparam param="inschrijvingsgeld" default="" /]" />
    <input id="v_studieduur" name="CustomFields[53]" type="hidden" value="[urlparam param="studieduur" default="" /]" />
    <input id="v_opleidingcheques" name="CustomFields[54]" type="hidden" value="[urlparam param="opleidingcheques" default="" /]" />
    <input id="v_kmoportefeuille" name="CustomFields[55]" type="hidden" value="[urlparam param="kmoportefeuille" default="" /]" />
    <input id="v_school" name="CustomFields[70]" type="hidden" value="[urlparam param="school" default="" /]" />
    <input id="v_dl" name="CustomFields[74]" type="hidden" value="[urlparam param="dl" default="" /]" />
    <input id="v_vroegboekkorting" name="CustomFields[73]" type="hidden" value="[urlparam param="vroegboekkorting" default="" /]" />
    <input id="v_vroegboekkortingspercentage" name="CustomFields[71]" type="hidden" value="[urlparam param="vroegboekkortingspercentage" default="" /]" />
    <input id="v_vroegboektotaal" name="CustomFields[72]" type="hidden" value="[urlparam param="vroegboektotaal" default="" /]" />
    <input id="v_hasselt" name="CustomFields[77]" type="hidden" value="[urlparam param="vroegboektotaal" default="" /]" />
    <input type="hidden" name="CustomFields[80]" id="meervoud" value="">
    <input type="hidden" name="CustomFields[79]" id="extra-zin" value="">
    <input type="hidden" name="CustomFields[81]" id="ExtraCursus" value="">
    <input id="v_querystring" name="CustomFields[75]" type="hidden" value="" /></div>
    <div></div>
    <div id="TANDERE"><b class='tip'><img src="http://icons.iconarchive.com/icons/iconleak/or/256/light-bulb-icon.png" height="25" width="25"> Tip!</b><br><br>Veel studenten volgen deze opleiding, aangevuld met de <b>thuiscursus bedrijfsbeheer</b>. Zo behaal je snel het nodige attest om als zelfstandige te kunnen starten. Vandaag geniet je van <u>50% korting</u> op de cursus bedrijfsbeheer, als je deze erbij neemt. Heel concreet: je betaalt voor deze extra cursus maar €90 i.p.v. €180.</br>
    <input class="Ja" type="submit" onClick="VerwerkPromoCodeB()" value="Ja, dat doe ik" />
    <a class='Nee' href="#"  onClick="VerwerkPromoCodeN()">Nee, liever niet</a>
    </div>
    <div id="TBEDRIJ"><b class='tip'><img src="http://icons.iconarchive.com/icons/iconleak/or/256/light-bulb-icon.png" height="25" width="25">Tip!</b><br><br>Geïnteresseerd om je zaak ook online te starten? Veel studenten volgen de cursus bedrijfsbeheer, aangevuld met de <b>thuiscursus webshop</b>. Zo doe je snel de nodige kennis op om ook op het web geld te verdienen! Als je nu inschrijft op de cursus webshop (€200), geniet je van 50% korting op de cursus bedrijfsbeheer. Heel concreet: je betaalt maar €90 i.p.v. €180. <br>
    <input class="Ja" type="submit" onClick="VerwerkPromoCodeW()" value="Ja, dat doe ik" />
    <a class='Nee' href="#"  onClick="VerwerkPromoCodeN()">Nee, liever niet</a>
    </div>


    [/three_fourth]
    [one_fourth_last]
    [titled_box title="Praktische info" align="center"]
    [fancy_list style = "check_list" variation="black"]
    <font style="text-transform:uppercase; font-weight:bold;">[urlparam param="cursus" default="" /]</font>
    <ul>
        <li>Lesgeld: <span id="prijspromo">[urlparam param="inschrijvingsgeld" default="" /]</span> euro</li>
    <li>Beschikbaar: [urlparam param="beschikbaar" default="" /]</li>
        <li>Voor iedereen: ja</li>
        <li>Studieduur: [urlparam param="studieduur" default="" /] mnd</li>
        <li>Erkend diploma: ja</li>
        <li>Opleidingscheques: [urlparam param="opleidingcheques" default="" /]</li>
        <li>KMO-portefeuille: [urlparam param="kmoportefeuille" default="" /]</li>
    </ul>

非常感谢你的帮助。

0 个答案:

没有答案