Kristabs Posted June 13, 2006 Report Share Posted June 13, 2006 Man ir ievades lauks un kad lietotaajs nospiezh enter, tad vajag izpildiit manu JS funkciju. Kaa to vareetu panaakt? Tas ir vajadziigs web chatam. Tagad ir taa, ka es ierakstu savu rindinju un jaaspiezh pogu suutiit, lai kautkas notiek. Kad pieliek <form> tagus, tad vinsh enter saprot, bet paarlaadee visu manu lapu, bet lai izdariitu tikai to ko man vajag, tad ir tikai jaaizpilda viena JS funkcija. tiko dadomaajos liidz kautkam tip - <form onSubmit="kautkaa_apstaadinaat_paarlaadi(); mana_JS_func();"> Tikai kaa buutu pareizi, es nevaru iedomaaties pashlaik. Link to comment Share on other sites More sharing options...
andrisp Posted June 13, 2006 Report Share Posted June 13, 2006 Vai nu savā funkcijā, vai arī onsubmit beigās ieliec return false; Link to comment Share on other sites More sharing options...
Kristabs Posted June 13, 2006 Author Report Share Posted June 13, 2006 tas palīdzēja!! Paldies! Link to comment Share on other sites More sharing options...
v3rb0 Posted June 13, 2006 Report Share Posted June 13, 2006 enteru var ķert arī bez form taga function keyhandler(evt) { var key = evt.which ? evt.which : evt.keyCode; if(key == 13) alert("nospiedi <enter>"); } un <body onkeypress="keyhandler(event)"> Link to comment Share on other sites More sharing options...
bubu Posted June 13, 2006 Report Share Posted June 13, 2006 nu nevajag jau body onkeypress. Pilnīgi pietiks arī tam input lauciņam uzlikt onkeypress eventu. Link to comment Share on other sites More sharing options...
Stopp Posted June 18, 2006 Report Share Posted June 18, 2006 offtopic: kur var uzzināt katrai pogai šitādu ciparu ? (nu tā kā laikam enter ir 13) Link to comment Share on other sites More sharing options...
bubu Posted June 18, 2006 Report Share Posted June 18, 2006 alert(key); vai http://www.lookuptables.com/ vai http://en.wikipedia.org/wiki/ASCII Link to comment Share on other sites More sharing options...
Stopp Posted June 18, 2006 Report Share Posted June 18, 2006 paldies Link to comment Share on other sites More sharing options...
Recommended Posts