priedzha Posted March 4, 2007 Report Share Posted March 4, 2007 Kā ar javascript palīdzību var uztaisīt funkciju show/hide uz html formām? Piem. ir links un, kad uzspiežu uz linka, tad parādās/pazūd attiecīgās formas Link to comment Share on other sites More sharing options...
Delfins Posted March 4, 2007 Report Share Posted March 4, 2007 <div id="f1"><form> ... var div_f1 = docuement.getelementById('f1'); div_f1.display = 'none'; // block Link to comment Share on other sites More sharing options...
hackerman Posted March 4, 2007 Report Share Posted March 4, 2007 A kā tad viņu var mainīt? Neredzu tur nevienu pogu :) Link to comment Share on other sites More sharing options...
Exzo Posted March 4, 2007 Report Share Posted March 4, 2007 function toggle(id) { var elem = document.getElementById(id); if (elem.style.display == '') { elem.style.display = 'none'; } else { elem.style.display = ''; } } un uzliec onclick="toggle('kaukaads_id')" jebkuram elementam Link to comment Share on other sites More sharing options...
Kaklz Posted March 4, 2007 Report Share Posted March 4, 2007 Iesaku paskatīties jQuery virzienā. Līdz ar šāda veida izstrādes metodēm JavaScript izstrāde iegūst pavisam citu jēgu kā līdz šim. http://docs.jquery.com/Effects Link to comment Share on other sites More sharing options...
hackerman Posted March 4, 2007 Report Share Posted March 4, 2007 A kā var dabūt vispirms "show" un tad, ja grib "hide" ? Man tagad sanāca, ka forma parādās un es viņu varu palsēpt, bet gribas lai parādās tikai pēc klika =] Link to comment Share on other sites More sharing options...
Exzo Posted March 4, 2007 Report Share Posted March 4, 2007 #kaukaads_id { display: none; } Link to comment Share on other sites More sharing options...
hackerman Posted March 4, 2007 Report Share Posted March 4, 2007 Kautkā nesanāca apvienot ar to skriptu... =/ Link to comment Share on other sites More sharing options...
Exzo Posted March 4, 2007 Report Share Posted March 4, 2007 Blah, tā taču ir CSS definīcija iekš stailšīta... Link to comment Share on other sites More sharing options...
hackerman Posted March 4, 2007 Report Share Posted March 4, 2007 <style type="text/css"> #f1 { display: none; } </style> <script> function toggle(id) { var elem = document.getElementById(id); display: 'none'; if (elem.style.display == '') { elem.style.display = 'none'; } else { elem.style.display = ''; } } </script> Paslēpa, bet nezkapē vairs nedabojas tas javascript? ;D Link to comment Share on other sites More sharing options...
Exzo Posted March 4, 2007 Report Share Posted March 4, 2007 kas tas par "display: 'none';" JS funkcijā? Link to comment Share on other sites More sharing options...
hackerman Posted March 4, 2007 Report Share Posted March 4, 2007 Ops...mans stulbums tur ir :) Stulbumu izņēmu ārā, bet nešancē vienalga. Link to comment Share on other sites More sharing options...
Exzo Posted March 4, 2007 Report Share Posted March 4, 2007 pārliecinies vai ID ir pareizi sarakstīti. Link to comment Share on other sites More sharing options...
hackerman Posted March 4, 2007 Report Share Posted March 4, 2007 ID ir pareizi, jo pirmstam javascript strādāja un style arī strādā pašlaik jo pazuda jau tās formas ar to id :) Un tikko patestēju, nodzēsu nost to style un javascript gāja :) Link to comment Share on other sites More sharing options...
priedzha Posted March 5, 2007 Author Report Share Posted March 5, 2007 Nu kā tad tur īsti ir? Link to comment Share on other sites More sharing options...
Recommended Posts