cali Posted May 16, 2011 Report Share Posted May 16, 2011 (edited) Imam pitanje koje večeras nisam sposoban da rešim, jer mi je mozak zakucao. Treba da napravim stranu koja će tražiti da unesem neku vrednost, i ako je ta vrednost cifra od 1 do 5 da mi izbaci odgovarajuću vrednost. Problem je što nisam lepo odredio definiciju varijable, jer šta god da unesem skripta prepozna kao nešto šesto (default u switch petlji) Imate li ideju gde sam se sjebao? I bonus pitanje, koji debugger preporučujete za JS? <HTML> <HEAD> <TITLE> Meh skripta </TITLE> <script LANGUAGE="JavaScript"> function DaniUNedelji(podatak){ var podatak = document.form1.podatak.value; switch(podatak) { case 1: document.writeln("Nedovoljan"); break; case 2: document.writeln("Dovoljan"); break; case 3: document.writeln("Dobar"); break; case 4: document.writeln("Vrlo Dobar"); break; case 5: document.writeln("Odlican"); break; default: document.writeln("Meh."); } } </SCRIPT> </HEAD> <BODY> <FORM name="form1" METHOD="POST" enctype=application/x-www-form-urlencoded> Ime:<BR> <INPUT TYPE="text" NAME="podatak"><BR> <INPUT TYPE="BUTTON" OnClick="DaniUNedelji(podatak)" VALUE="Submit"> </FORM> </SCRIPT> </BODY> </HTML> Edited May 17, 2011 by cali Quote Link to comment Share on other sites More sharing options...
cali Posted May 17, 2011 Author Report Share Posted May 17, 2011 Malo kafe i sna rešilo problem. Koliko sam skapirao definisao sam ulazni podatak kao tekst, a Case komandi sam zadao da traži brojeve. Prepravljanje iz case 1 u case "1" je rešilo problem. Hvala što ste prisustvovali mom rantu :D A sada slika jelena koji češe muda. Quote Link to comment Share on other sites More sharing options...
Trooper Posted May 17, 2011 Report Share Posted May 17, 2011 I bonus pitanje, koji debugger preporučujete za JS? Chrome, tj Developer Tools u istom Quote Link to comment Share on other sites More sharing options...
milutin_mica Posted May 17, 2011 Report Share Posted May 17, 2011 NOTEPAD! Quote Link to comment Share on other sites More sharing options...
Trooper Posted May 17, 2011 Report Share Posted May 17, 2011 ? Quote Link to comment Share on other sites More sharing options...
Doca Posted May 17, 2011 Report Share Posted May 17, 2011 (edited) Vidim da dosta ljudi hvali Aptana studio 3, pa probaj. Edited May 17, 2011 by Doca. Quote Novi forum smrdi Link to comment Share on other sites More sharing options...
GOd Posted May 18, 2011 Report Share Posted May 18, 2011 Cali sledeci put okachi u nekoj drugoj boji a ne zutoj, dobio sam epileptichni napad. Quote Link to comment Share on other sites More sharing options...
dvnityCker Posted May 18, 2011 Report Share Posted May 18, 2011 prosledjujes mu ceo element ovim, umesto samo vrednost OnClick="DaniUNedelji(podatak)" probaj ovako nesto: <INPUT TYPE="text" ID="podatak" NAME="podatak"> <INPUT TYPE="BUTTON" OnClick="DaniUNedelji(document.getElementById('podatak').value)" VALUE="Submit"> ja koristim firebug za sve js-related akcije Quote The people can always be brought to the bidding of the leaders. That is easy. All you have to do is tell them they are being attacked and denounce the pacifists for lack of patriotism and exposing the country to danger. It works the same way in any country. Link to comment Share on other sites More sharing options...
cali Posted May 18, 2011 Author Report Share Posted May 18, 2011 prosledjujes mu ceo element ovim, umesto samo vrednost OnClick="DaniUNedelji(podatak)" probaj ovako nesto: <INPUT TYPE="text" ID="podatak" NAME="podatak"> <INPUT TYPE="BUTTON" OnClick="DaniUNedelji(document.getElementById('podatak').value)" VALUE="Submit"> Hvala, ovo je def. bolje od onoga što sam ja sklepao. Quote Link to comment Share on other sites More sharing options...
dvnityCker Posted May 18, 2011 Report Share Posted May 18, 2011 a naravno mozes i samo podatak.value da koristis umesto celog getDocumentById, ali je praksa da se koristi ID Quote The people can always be brought to the bidding of the leaders. That is easy. All you have to do is tell them they are being attacked and denounce the pacifists for lack of patriotism and exposing the country to danger. It works the same way in any country. 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.