Forum » Programiranje » javascript napaka!
javascript napaka!
kretze ::
zdravo kaj ve kdo kje je napaka v tej kodi??
<!DOCTYPE html> <head> <title>charchter 5 example 2 </title> <script type="text/javascript"> function checkchartype(chatToCheck) { var returnvalue=0; var charcode=chatToCheck.charCodeAt(0); if(charcode>="A".charCodeAt(0)&&charcode<="Z".charCodeAt(0)) { returnvalue="U"; } else if(charcode>="a".charCodeAt(0)&&charcode<="z".charCodeAt(0)) { returnvalue="L"; } else if(charcode>="0".charCodeAt(0)&&charcode<="9".charCodeAt(0)) { returnvalue="N"; } } </script> </head> <body> <script type="text/javascript"> var mystring=prompt("eneter some text","2"); switch(checkchartype(mystring)) { case "U": document.write("first charachter was uppercase "); break; case "L": documnet.write("first charachter was lowwer case"); break; case "N": document.write("first charachter was a number "); break; default: document.write("first charchter was not a charahcter or a number "); } </script> </body> </html>
Timmah ::
charchter --> character
case "L":
documnet --> document
case "L":
documnet --> document
donde esta francesca
Zgodovina sprememb…
- spremenil: Timmah ()
kretze ::
ej kaj ve kdo zakaj mi včasih v chromu ko grem pod f12 pa tam pod console ne prikaže nobenih errorjev??
Nublet ::
JercSI ::
Med drugim ti v funkciji checkchartype manjka na koncu return returnvalue;
Ali pa spremeni returnvalue="U"; v return "U"; itd.. na koncu pa dodaš return 0;
Ali pa spremeni returnvalue="U"; v return "U"; itd.. na koncu pa dodaš return 0;
Vredno ogleda ...
Tema | Ogledi | Zadnje sporočilo | |
---|---|---|---|
Tema | Ogledi | Zadnje sporočilo | |
» | [javaScript] Preverjanje formata zapisa EMŠOOddelek: Programiranje | 2936 (2556) | win64 |
» | [C#] Pravice za spreminjanje in restore bazeOddelek: Programiranje | 1056 (876) | nuclear |
» | Pomoč pri Flash MX 2004Oddelek: Programska oprema | 1034 (926) | Vesoljc |
» | read integer v javiOddelek: Programiranje | 1376 (1277) | kopernik |
» | novi java problemiOddelek: Programiranje | 1202 (1062) | StratOS |