anonīms Posted September 23, 2009 Report Share Posted September 23, 2009 (edited) ar php viss būtu skaidrs, bet izmantoju šādu, jquery. <div class="tab"><a href="#" onclick="radit('viesi'); return false;" <?php if($_GET['o'] == 'viesi' OR !$_GET['o']) { echo 'class="current"'; }?>>Viesi</a></div> <div class="tab"><a href="#" onclick="radit('draugi'); return false;" <?php if($_GET['o'] == 'draugi') { echo 'class="current"'; } ?>>Draugi</a></div> kā man linkiem pielikt klasi, kad uzspiež, jo reāli jau gets pie linka neparādas? Vajag, kad uzspiež uz linka tas kļūtu current (darbojas ar jquery) Edited September 23, 2009 by anonīms Quote Link to comment Share on other sites More sharing options...
briedis Posted September 23, 2009 Report Share Posted September 23, 2009 (edited) Piemet vajadzīgajiem linkiem klasi "selectable" (es ceru, ka tu zini, ka vienam elementam var būt vairākas klases, piem. <div class="box selected">) <a href="#" onclick="" class="selectable"></a> Tad dinamiski ar jquery pievieno click eventu. $(document).ready(function(){ $("a.slectable").click(function(){ //novācam visiem iepriekšējiem to clicked klasi $("a.slectable").removeClass("clicked"); //pievienojam īstajam $(this).addClass("clicked"); }); }); ...un viss :) ..uhh, kā mīlu jquery :D hmm, a kādā sakāra tev tur php kodā if'a ir "OR", nevis "||" ?? Edited September 23, 2009 by briedis Quote Link to comment Share on other sites More sharing options...
anonīms Posted September 23, 2009 Author Report Share Posted September 23, 2009 || no OR ar kko atšķiras? Quote Link to comment Share on other sites More sharing options...
rATRIJS Posted September 23, 2009 Report Share Posted September 23, 2009 ne ar ko neatšķiras if($a == 1 || $b == 1) == if($a == 1 or $b == 1) Quote Link to comment Share on other sites More sharing options...
briedis Posted September 23, 2009 Report Share Posted September 23, 2009 || no OR ar kko atšķiras? Jā, paskatījos doc'os, neatšķiras, bet jocīgi tāpat... nezinu vai laba prakse :) ...manis dotais piemērs palīdzēja? Quote Link to comment Share on other sites More sharing options...
bubu Posted September 23, 2009 Report Share Posted September 23, 2009 OR no || atškiras ar prioritātēm (attiecībā pret citiem operatoriem). $b = $a or $a = 1; echo $b; Izvadīs pavisam citu vērtību, ja or vietā ieliksi || Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.