Mikijs Posted July 2, 2008 Report Share Posted July 2, 2008 vopsem man ir funkcija function showhide(id, myid) { var element=document.getElementById(id); var myelement=document.getElementById(myid); if(element.style.display == "none") { element.style.display="block"; myelement.style.weight="bold"; } else { element.style.display="none"; myelement.style.weight="normal"; } } <a href="#" onclick="showhide('divid', 'spanid');">Kategorija</a> <span id='spanid'>Kategorijas</span> <div id='divid'><?=$cats?></div> Jautājums.. kapēc man teksts neiekrāsojas boldā? Link to comment Share on other sites More sharing options...
andrisp Posted July 2, 2008 Report Share Posted July 2, 2008 Tāpēc, ka ir nevis weight, bet font-weight ? :) Link to comment Share on other sites More sharing options...
Mikijs Posted July 2, 2008 Author Report Share Posted July 2, 2008 (edited) tas nestrādāja ari .. invalid assignment left-hand side[break on this error] myelement.style.font-weight="bold";\n Edited July 2, 2008 by Mikijs Link to comment Share on other sites More sharing options...
werd Posted July 2, 2008 Report Share Posted July 2, 2008 (edited) Tu šajā vietā norādi kuram elementam jāapskata style? if(element.style.display == "none") { Vai tad ne šādi? if(document.getElementById(myd).style.display == "none"){.. Edited: Jā tiešām!Atvainojos kkā atri pārskŗeju pirmajām rindiņām pāri! Edited July 2, 2008 by phpjanis Link to comment Share on other sites More sharing options...
andrisp Posted July 2, 2008 Report Share Posted July 2, 2008 phpjanis, un kaada atshkjiriiba, ja jau vinjs jau ir element nodefineejis ? Mikijs, kaa tu meegjinaaji ? .font-weight vai .fontWeight ? Link to comment Share on other sites More sharing options...
Mikijs Posted July 2, 2008 Author Report Share Posted July 2, 2008 Tu šajā vietā norādi kuram elementam jāapskata style?if(element.style.display == "none") { Vai tad ne šādi? if(document.getElementById(myd).style.display == "none"){.. ieskaties koda un ieraudzisi ka tas ir nodefinets zem varda "element" Link to comment Share on other sites More sharing options...
Mikijs Posted July 2, 2008 Author Report Share Posted July 2, 2008 a tiesam svitrinju nevaig.. paldies :) Link to comment Share on other sites More sharing options...
bubu Posted July 2, 2008 Report Share Posted July 2, 2008 Var arī ar svītriņu: element.style["font-weight"] = "bold"; Link to comment Share on other sites More sharing options...
indoom Posted July 2, 2008 Report Share Posted July 2, 2008 Tā jau arī nevarēs. Javascriptā neizmanto svītriņas stilos. Ir .fontWeight Link to comment Share on other sites More sharing options...
v3rb0 Posted July 2, 2008 Report Share Posted July 2, 2008 ar svītriņu biš citādi, bet var gan arī ar svītriņu document.getElementById("post-main-86818").style.setProperty('font-weight', 'bold',''); un skatīties uz burtiem pirmajā postā šinī pašā lapā. Link to comment Share on other sites More sharing options...
mefisto Posted July 3, 2008 Report Share Posted July 3, 2008 Nah nevar vienkārsi pielikt un noņemt css klasi ? Man kaut kā liekas , ka tas būtu 100x vieglāk, kā pisties ar katras īpašības uzstādīšanu .. Link to comment Share on other sites More sharing options...
Recommended Posts