eT` Posted July 28, 2011 Report Share Posted July 28, 2011 Kapēc IE nestrādā šis kods? jQuery ir pareizs. ar $.get() arī IE nestrādāja :( function setActive(id,page) { document.getElementById('1').setAttribute('class',''); document.getElementById('2').setAttribute('class',''); document.getElementById('3').setAttribute('class',''); document.getElementById('4').setAttribute('class',''); document.getElementById('5').setAttribute('class',''); document.getElementById(id).setAttribute('class','active'); $('#content').load('pages/'+page+'.php'); return false; } Quote Link to comment Share on other sites More sharing options...
0 codez Posted July 28, 2011 Report Share Posted July 28, 2011 (edited) Ja jau izmanto jQuery, tad labāk būtu kaut kā tā (jāpielāgo pēc reālās situācijas): $('#'+id).addClass("active").siblings().removeClass("active"); $('#content').load('pages/'+page+'.php'); Edited July 28, 2011 by codez Quote Link to comment Share on other sites More sharing options...
0 rATRIJS Posted July 28, 2011 Report Share Posted July 28, 2011 (edited) #id nevar buut cipars lieto klases pirmo 5 funkcijas rindinju aizstaashanai ja jau izmanto jQuery tad nelieto document.getElementById, bet gan $(selector) pages/{PAGE}.php eksistee? Edited July 28, 2011 by rATRIJS Quote Link to comment Share on other sites More sharing options...
0 eT` Posted July 28, 2011 Author Report Share Posted July 28, 2011 (edited) update <script type="text/javascript" language="javascript"> function setActive(id,page) { $('#'+id).addClass("active").siblings().removeClass("active"); $('#content').fadeOut('slow').load('pages/'+page+'.php').fadeIn('slow'); return false; } </script> <li id="viens" onclick="setActive('viens','index')"><a href="#">Sākums</a></li> un uz visiem pārlūkiem izņemot IE strādā. Edited July 28, 2011 by eT` Quote Link to comment Share on other sites More sharing options...
0 codez Posted July 28, 2011 Report Share Posted July 28, 2011 click eventus arī vajadzētu piešķirt ar jQuery piešķir ul klasi, piemērā, abc. Tad: $(function(){ $('.abc li').click(function(){ var page=$(this).attr('page'); $(this).addClass("active").siblings().removeClass("active"); $('#content').load('pages/'+page+'.php'); }); }); markups attiecīgi <ul class="abc"> <li page="index">lalal</li> <li page="help">lalal</li> </ul> P.S. Bet tas, ka IE nestrādā, paskaties vai kaut kur nav console... aizmirst vai kaut kas tāds. Quote Link to comment Share on other sites More sharing options...
0 codez Posted July 28, 2011 Report Share Posted July 28, 2011 Šeit variants, vari patestēt vai iet uz IE: http://jsfiddle.net/HRbsq/ Quote Link to comment Share on other sites More sharing options...
0 eT` Posted July 28, 2011 Author Report Share Posted July 28, 2011 Paldies, codez. #5 nostrādāja :) Quote Link to comment Share on other sites More sharing options...
Question
eT`
Kapēc IE nestrādā šis kods?
jQuery ir pareizs.
ar $.get() arī IE nestrādāja :(
Link to comment
Share on other sites
6 answers to this question
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.