nelabs Posted June 2, 2008 Report Share Posted June 2, 2008 man ir kods var items=1; function AddItem() { div=document.getElementById("items"); button=document.getElementById("add"); items++; newitem="<b>Attēls " + items + ": <\/b>"; newitem+="<input type=\"file\" name=\"userfile[]\" />"; newitem+="<br>"; newnode=document.createElement("span"); newnode.innerHTML=newitem; div.insertBefore(newnode,button); } lai pievienotu elementu <div id="items"> <b>Attēls :</b> <input type="file" name="userfile[]" /><br /> <input type="button" value="+" onClick="AddItem();" id="add"/><br /> </div> uz firefox straadaa bet uz Iexplorer izmet Object expected. ka varetu atrisinat so problemu? Link to comment Share on other sites More sharing options...
Aleksejs Posted June 2, 2008 Report Share Posted June 2, 2008 Tikai minējums - bet pamēģini nesaukt mainīgos tādos vārdos kā div, button utt... Varbūt IE tos interpretē citādi un uztver kā rezervēto visu divu kopu vai visu buttonu kopu. Par kuru rindiņu tieši viņš tā lamājas? Link to comment Share on other sites More sharing options...
marcis Posted June 3, 2008 Report Share Posted June 3, 2008 Pietam: var mainigais = "kautkas"; Link to comment Share on other sites More sharing options...
andrisp Posted June 3, 2008 Report Share Posted June 3, 2008 marcis, tas jau mainiis tikai mainiigaa scope. Link to comment Share on other sites More sharing options...
marcis Posted June 3, 2008 Report Share Posted June 3, 2008 Bet vispār, man šis kods strādā uz FF2, IE7, IE6. Link to comment Share on other sites More sharing options...
bubu Posted June 3, 2008 Report Share Posted June 3, 2008 ka varetu atrisinat so problemu? Lietojot debugeri. Link to comment Share on other sites More sharing options...
andrisp Posted June 3, 2008 Report Share Posted June 3, 2008 Vai arī aiz katras rindiņas alert'ojam mainīgo saturu un skatamies, vai tie satur, to ko tiem vajadzētu saturēt. :) Link to comment Share on other sites More sharing options...
Joyride Posted June 3, 2008 Report Share Posted June 3, 2008 Turpinot Alekseja domu - nesauc mainīgos tādos vārdos, kādi Tev ir izmantoti id vērtībām: var items=1; un <div id="items"> Link to comment Share on other sites More sharing options...
marcis Posted June 3, 2008 Report Share Posted June 3, 2008 Joyride, tas jau gan neko nemaina. Link to comment Share on other sites More sharing options...
Recommended Posts