bro Posted September 23, 2005 Report Share Posted September 23, 2005 Vai te ir kaada kljuuda.. ? kaapec shis skripts nestraadaa ?:) <script> window.unload = function() { var bildes = document.getElementsByTagName("img"); for (var i=0, len=bildes.length; i<len; ++i) { var img = bildes[i]; if (img.src.indexOf("http://en.siteburg.com/pic/24_text.gif")!=-1) { img.style.display = "none"; } } } </script> Link to comment Share on other sites More sharing options...
Delfins Posted September 23, 2005 Report Share Posted September 23, 2005 (edited) onload + img.style.display = "none"; nomainīt uz img = NULL; Edited September 23, 2005 by Delfins Link to comment Share on other sites More sharing options...
bubu Posted September 23, 2005 Report Share Posted September 23, 2005 (edited) Vai tad img = NULL; izņems bildi ārā no html dokumenta, ja img ir vienkāršs mainīgais? Un tāds NULL vispār ir nedefinēts. Vajag null. Edited September 23, 2005 by bubu Link to comment Share on other sites More sharing options...
Delfins Posted September 23, 2005 Report Share Posted September 23, 2005 (edited) na to i est' ruki, shtob samomu postavit' i proverit' :) PS: izdzēsīs gan bildi! es piem. izmantoju šajā vietā function selectRemoveItems( list ) { if ( !list ) return false; for ( i=0; i<list.options.length; i++ ) { if ( list.options[i].selected ) { list.options[i] = null; i--; } } } PPS: ja nezinātu, neteiktu :) Edited September 23, 2005 by Delfins Link to comment Share on other sites More sharing options...
bubu Posted September 23, 2005 Report Share Posted September 23, 2005 Nu no tā select bokša dzēsīs, jo to null jau tu piešķir pa tiešo option elementam. Ja tu darītu: var x = list.options[i]; x = null; Vai tad dzēstu? JS taču skaita references. list.options - 1 reference. Kad to piešķir mainīgajam x - 2 references. x = null - 2-1=1 reference. Nav jādzēš tātad (>0). Pie tam: tu var keywordu nelieto? Visus mainīgos par globāliem pataisi? Link to comment Share on other sites More sharing options...
Delfins Posted September 23, 2005 Report Share Posted September 23, 2005 kā tad, protams, ka lietoju... Link to comment Share on other sites More sharing options...
bubu Posted September 24, 2005 Report Share Posted September 24, 2005 (edited) Es tevi kautkā nesaprotu. Man nesanāk ar null izdzēst: <html><head><script type="text/javascript"> function remove() { var div = document.getElementById("blabla"); div = null; // div.parentNode.removeChild(div); - es parasti šitā daru } </script></head><body> <div id="blabla">šitajam jāpazūd</div> <input type="button" onclick="remove();" value="izdzēst tekstu"/> </body></html> Edited September 24, 2005 by bubu Link to comment Share on other sites More sharing options...
Delfins Posted September 24, 2005 Report Share Posted September 24, 2005 Jā... izskatās tas null strādā tikai Options (visticamāk tāpēc, ka option ir masīva elements) Link to comment Share on other sites More sharing options...
bubu Posted September 24, 2005 Report Share Posted September 24, 2005 Nu tieši tā! Tāpēc, ka null piešķir pa tiešo. Un tiek iznīcināta vienīgā reference. Link to comment Share on other sites More sharing options...
Recommended Posts