archux Posted December 29, 2006 Report Share Posted December 29, 2006 visi zinam kaad raugos ir ka ajauna lapa tiek atveerta ta jauna reklaama valjaa es arii ta gribu kas man un ka jaadara? Link to comment Share on other sites More sharing options...
andrisp Posted December 29, 2006 Report Share Posted December 29, 2006 Pieturzīmes, lūdzu! Un es nezinu, kas tā par reklāmu. Link to comment Share on other sites More sharing options...
archux Posted December 29, 2006 Author Report Share Posted December 29, 2006 texstu rindinjas! Link to comment Share on other sites More sharing options...
andrisp Posted December 29, 2006 Report Share Posted December 29, 2006 Ā, tās reklāmas. Nu piem: php.net/array ($reklama[0] = 'Reklāma #1', $reklama[1] = 'Reklāma #2' utt) php.net/rand (rand(0, 1)) php.net/echo (echo $reklama[rand(0, 1)]) Link to comment Share on other sites More sharing options...
archux Posted December 29, 2006 Author Report Share Posted December 29, 2006 a tur kur 'Reklāma #1' tur jaaraksta piemeeram <a href= 'http://aaa.lv/' > jani pngviini shajaa zemee ;D </a> Vai pareizi sapratu? Link to comment Share on other sites More sharing options...
andrisp Posted December 29, 2006 Report Share Posted December 29, 2006 A tu pamēģini ;) Link to comment Share on other sites More sharing options...
archux Posted December 29, 2006 Author Report Share Posted December 29, 2006 tagad meeginaashu :) Link to comment Share on other sites More sharing options...
kerz Posted December 29, 2006 Report Share Posted December 29, 2006 Var arī ar js.. Link to comment Share on other sites More sharing options...
archux Posted December 29, 2006 Author Report Share Posted December 29, 2006 a kaa ar js buus ??? Link to comment Share on other sites More sharing options...
Grey_Wolf Posted December 29, 2006 Report Share Posted December 29, 2006 archux --> a tu paprasi kerz... Bet varu pateikt uzreiz ar JS var bet tas ir ...... (CENZETS) ... Link to comment Share on other sites More sharing options...
archux Posted December 29, 2006 Author Report Share Posted December 29, 2006 nu taa paciiniijos un atradu <script language="JavaScript"> function random_content(){ var mycontent=new Array() //specify random content below. mycontent[1]='rand teksts 1' mycontent[2]='rand teksts 2' mycontent[3]='rand teksts 3' mycontent[4]='rand teksts 4' mycontent[5]='rand teksts 5' var ry=Math.floor(Math.random()*mycontent.length) if (ry==0) ry=1 document.write(mycontent[ry]) } random_content() //--> </script> Link to comment Share on other sites More sharing options...
raitis Posted April 6, 2007 Report Share Posted April 6, 2007 nu taa paciiniijos un atradu <script language="JavaScript"> function random_content(){ var mycontent=new Array() //specify random content below. mycontent[1]='rand teksts 1' mycontent[2]='rand teksts 2' mycontent[3]='rand teksts 3' mycontent[4]='rand teksts 4' mycontent[5]='rand teksts 5' var ry=Math.floor(Math.random()*mycontent.length) if (ry==0) ry=1 document.write(mycontent[ry]) } random_content() //--> </script> Bet kādā veidā panākt,lai tekstu,kas publicējas njem nevis no scripta,bet gan no faila? Piemēram "rand teksts 1" būtu hiperlinks uz kadu teksta failu (piem., teksts.txt) un kods to publicētu? Link to comment Share on other sites More sharing options...
andrisp Posted April 6, 2007 Report Share Posted April 6, 2007 Bet kādā veidā panākt,lai tekstu,kas publicējas njem nevis no scripta,bet gan no faila? Glabā rindas failā un ielasi ar, piemēram, file. Bet vispār skripts arī ir fails. Piemēram "rand teksts 1" būtu hiperlinks uz kadu teksta failu (piem., teksts.txt) un kods to publicētu? <a href="teksts.txt">rand teksts 1</a> ? Link to comment Share on other sites More sharing options...
Stopp Posted April 6, 2007 Report Share Posted April 6, 2007 (edited) <?php $adreses=array("hā tē tē pē", "un tā tālāk", "visas adreses"); $teksti=array("spied šiet!", "free smileys!", "free animal porn viagra!"); $r=rand(0, (count($adreses)-1)); echo '<a href="'.$adreses[$r].'">'.$teksti[$r].'</a>'; ?> Ar javaskriptu tas pats, tikai javaskripta sintakse (kas daudz neatšķiras no PHP). Edited April 6, 2007 by Stopp Link to comment Share on other sites More sharing options...
andrisp Posted April 6, 2007 Report Share Posted April 6, 2007 Stopp, droši jau varētu iztikt ar vienu masīvu koda tīrībai. Link to comment Share on other sites More sharing options...
Recommended Posts