snach15 Posted September 17, 2010 Report Share Posted September 17, 2010 (edited) piemēram man ir linki vairāki <li><a href="links1">1</a></li> <li><a href="links2">2</a></li> <li><a href="links3">3</a></li> kā lai uztaisa tā lai uzpiežot piem uz kādu no šiem nevis atveras cita lapa bet tieši attiecīgais scripts kas ir iegš tāpaša faila .. cik sapratu bija jātaisa tas ar case bet nesaprotu kā ... princips ir kautkāds tāds ... <? case "piemers1": if(test(1) == 0){ print "biezpiens";} break; case "piemers2": if(test(2) == 0) { print "kechups";} break; ?> Edited September 17, 2010 by snach15 Quote Link to comment Share on other sites More sharing options...
codez Posted September 17, 2010 Report Share Posted September 17, 2010 universālā gadījumā šādi, bet, ja vienkārši, tad katram a piešķir id un pie-bind-o savu click envent-u. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script> S={ "alert.php":function(){ alert('Hello'); }, "console.php":function(){ console.info('hi'); }, "alert2.php":function(){ alert('Alert II'); } } $(function(){ $('#list').delegate('a','click',function(){ var f=$(this).attr('href'); S[f].call(); return false; }); }); </script> <style> </style> </head> <body> <ul id="list"> <li><a href="alert.php">Item 1</a></li> <li><a href="console.php">Item 2</a></li> <li><a href="alert.php">Item 3</a></li> <li><a href="alert2.php">Item 4</a></li> </ul> </body> </html> Quote Link to comment Share on other sites More sharing options...
Faks Posted September 17, 2010 Report Share Posted September 17, 2010 var jau rakstit ar get ari :) Quote Link to comment Share on other sites More sharing options...
snach15 Posted September 17, 2010 Author Report Share Posted September 17, 2010 tas javascript īsti neder man .. un arī īsti nemāku raksīt ar viņu .. varbūt varētu paradīt ar get kā tas izkatās ? Quote Link to comment Share on other sites More sharing options...
Faks Posted September 17, 2010 Report Share Posted September 17, 2010 (edited) Piemers Reals Ejos ! <?php $page = $_GET ; switch ($page) { case 'lapa1'; require ('lapa1.php'); break; default; require ('lapa1.php'); } ?> Nak sadalu links piemers <a href="/mans folders/?page=lapa1">Sadala 1</a> sadi luk tas rakstas :) protams ja nezi tad iesaku doties uz php kursiem :) maksa naudu vai ari macities no php gramatas vai enceklopedijas gramatas :) nu interneta var macities bet ar to bus par isu agrak vai velak :) labi lai teu veicas ! Edited September 17, 2010 by Faks Quote Link to comment Share on other sites More sharing options...
Леший Posted September 19, 2010 Report Share Posted September 19, 2010 kā lai uztaisa tā lai uzpiežot piem uz kādu no šiem nevis atveras cita lapa bet tieši attiecīgais scripts kas ir iegš tāpaša faila .. tas javascript īsti neder man .. Divi teikumi, kas izslēdz viens otru. Bez JS tu nedabūsi vajadzīgo rezultātu. Quote Link to comment Share on other sites More sharing options...
briedis Posted September 19, 2010 Report Share Posted September 19, 2010 iframe? :) Quote Link to comment Share on other sites More sharing options...
Леший Posted September 19, 2010 Report Share Posted September 19, 2010 briedis, i ko tu ar iframe darīsi bez JS? Quote Link to comment Share on other sites More sharing options...
snach15 Posted September 20, 2010 Author Report Share Posted September 20, 2010 bez JS tas ir iespējams .. jūs varbūt nesapratāt tieši ko cenšos panākt .. man piemēram ronis.php failā ir izvēlne ( test1 test2 test3 test4 test5 ) un zem tā html scripta ir PHP scripti .. kuri nedarbojas kamēr nav uzpiests uz izvēlni .. piem ja uzpiež test1 tad parādas tabula ar accountiem un parolēm .. ja uzpeiž test3 tad parādas piemēram vip useri un status ... Quote Link to comment Share on other sites More sharing options...
daGrevis Posted September 20, 2010 Report Share Posted September 20, 2010 HTML skripti... Quote Link to comment Share on other sites More sharing options...
snach15 Posted September 21, 2010 Author Report Share Posted September 21, 2010 tā arī nesanāk man nekas .. lūk piemēru uztaisīju : Te man rāda piemēram tagad Character Rankingu .. un tagad ķipa uzpiežu uz Guild ranking tad man tajā vietā kur bija Character rankings parādas guild rankings ... kā to lai izdaru ? Quote Link to comment Share on other sites More sharing options...
indoom Posted September 21, 2010 Report Share Posted September 21, 2010 Domā šitā? <a href="ranking.php?id=character" target="ranks">character ranking</a> <a href="ranking.php?id=guild" target="ranks">guild ranking</a> <iframe src="ranking.php?id=character" id="ranks" name="ranks" frameborder="0" style="width:500px; height:200px;"></iframe> Quote Link to comment Share on other sites More sharing options...
snach15 Posted September 21, 2010 Author Report Share Posted September 21, 2010 (edited) šitas variants ir vistuvākais bet iframe neder ... lūk piemērs kā tam būtu jāizkatās bet man kautkā neņem pretī .. jo kļūda ir tajā case test: .. nezinu kā pareizi norādīt uz to linku augšējo .. id jāpiešķir vai kautkas tamlīdzīģs ar nosaukums test un test2 ? <li><a href=index.php?page=test>Top Online Ranking</a></li> <li><a href=index.php?page=test2>Top Guild Ranking</a></li> <? case test: $purubum = "kashkisgf"; $gik = "g"; echo "<table width=200 height=100 border=1> <tr> <td> </td> </tr> </table>" if ($purumbum == $gik) { echo "ir vienads"; query ......... } else { echo "error";} break; case test2: $purubum2 = "hgdf"; $gik2 = "g"; echo "<table width=200 height=100 border=1> <tr> <td> </td> </tr> </table>" if ($purumbum2 == $gik2) { echo "ir vienads"; query ......... } else { echo "error";} break; Edited September 21, 2010 by snach15 Quote Link to comment Share on other sites More sharing options...
indoom Posted September 21, 2010 Report Share Posted September 21, 2010 Tāpēc jau domāts manuālis, lai uzzinātu, ja kaut ko nezini http://lv.php.net/manual/en/control-structures.switch.php switch ($_GET['page']) { case 'test': break; case 'test2': break; } Quote Link to comment Share on other sites More sharing options...
snach15 Posted September 21, 2010 Author Report Share Posted September 21, 2010 (edited) vo šitam vajadzētu iet .. un kā tagad ar to html pusi ? <li><a href=index.php?page=test>Top Online Ranking</a></li> <li><a href=index.php?page=test2>Top Guild Ranking</a></li> šādi mani pārmet uz citu linku .. pages/test2.php ja uzpiežu uz to Top Guilds ranking bet man vajadzētu tā lai linki paliek bet mainas tikai tā apakšā kur ir funkcijas.. id vai kautko tamlīdzīgu piemēram nevar norādīt uz attiecīgo Topu bet links paliek nemainīgs ? Edited September 21, 2010 by snach15 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.