cucumber Posted November 21, 2006 Report Share Posted November 21, 2006 Vai ar JS var izdarit ta ir bildes, un tas spiezot uz <- ->, proti var paskatities, bez lapas refreshoshanas? Un ja ta ir pirma bilde tad nevar nospiest <--, ja pedeja tad -->. Link to comment Share on other sites More sharing options...
Vebers Posted November 21, 2006 Report Share Posted November 21, 2006 Jā ir iespējams. Kā ? Iemet aci šeit. Ir tas vairākas reizes apspriests. Vai iemācies lietot search!! Link to comment Share on other sites More sharing options...
andrisp Posted November 21, 2006 Report Share Posted November 21, 2006 Var gan. Ko tieši nemāki izdarīt ? Palīdzēsim. Link to comment Share on other sites More sharing options...
cucumber Posted November 22, 2006 Author Report Share Posted November 22, 2006 <html> <body> <script type="text/javascript"> <!-- function move() { var myArray = new Array(); var c=-1 c=c+1 myArray[0] = "1"; myArray[1] = "2"; myArray[2] = "3"; if (c==3) c=0 document.getElementById('txt').innerHTML= myArray[c] } //--> </script> <input type="button" value="Back" onclick="move()"> <input type="button" value="Next" onclick="move()"><br /> <span id="txt"></span> </body> </html> Es gribetu, lai spiezot uz podzinam varetu staigat pa masivu, kaut vai ja spiez next tad c palielina par 1, un f-jai mov ka paremetru nodot 1 vai 0, tas ir pieskaitit pie c vai atnemt Link to comment Share on other sites More sharing options...
Delfins Posted November 22, 2006 Report Share Posted November 22, 2006 Kur ir problēma? Nemākam padot parametru f-jai? Link to comment Share on other sites More sharing options...
cucumber Posted November 22, 2006 Author Report Share Posted November 22, 2006 Ja. Un ka to c, sakuma pieskirt 0, tad manit ( jabut globalam) Link to comment Share on other sites More sharing options...
andrisp Posted November 22, 2006 Report Share Posted November 22, 2006 1) Pieglabā kautkur, kura bilde tev tiek rādīta. Var izmantot globālos js mainīgos, bet domāju, ka labāk kautkādā hidden input'ā. 2) Izsaucot move() fju, kaut kā norādi vai vajag nākamo bildi vai iepriekšējo. 3) Iekš fjas move() atkarībā no tā, kuru bildi vajag vai nu ņem pašreizējā bildes nr (to, ko pieglabāsi kautkur) + 1, vai arī pašreizējās bildes nr - 1. Pirms tam, protams, pārbaudi vai tāds elements masīvā ir (vai tāda bilde ir). 4) Katru reizi, kad tiek pārslēgta bilde uz priekšu, paskaties vai vēl ir bildes, ko rādīt. Ja nav, tad disablē Next. Tāpat arī, kad slēdz bildes uz atpakaļu. Link to comment Share on other sites More sharing options...
cucumber Posted November 22, 2006 Author Report Share Posted November 22, 2006 (edited) <html> <body> <script type="text/javascript"> <!-- var c=-1 // shitais it ka skaitas ka globalais ??? function move(dir) { var myArray = new Array(); if (dir==1) if(c!=0) c=c-1 if (dir==0) if(c!=2) c=c+1 myArray[0] = "1"; myArray[1] = "2"; myArray[2] = "3"; document.getElementById('txt').innerHTML= myArray[c] } //--> </script> <input type="button" value="Back" onclick="move(1)"> <input type="button" value="Next" onclick="move(0)"><br /> <span id="txt"></span> </body> </html> Man ta sanaca it ka iet. 4) var ari vienkarshi izlaist pa apli 12321 ... etc Edited November 22, 2006 by cucumber Link to comment Share on other sites More sharing options...
Recommended Posts