Walk the streets, what do I see, Shit on legs approaching me!
JavaScript - variabeln tolkas som string
Visa signatur
Visa signatur
Walk the streets, what do I see, Shit on legs approaching me!
Hej,
Nyss börjat pilla lite med javascript efter ett par års uppehåll och behöver lite hjälp. Får felet "document.getElementById("cc") is null"
<html>
<head>
<script type="text/javascript">
var cc = document.getElementById("cc").value
cc = parseInt(cc, 10);
function prefixCheck() {
if(cc<=659999 || cc>=304) {
alert("DinersClub not supported");
}while(cc=isNaN) {
alert("The input needs to be a number!");
break;
}
}
</script>
</head>
<body>
<form>
<input type="text" id="cc">
<input type="button" value="Genomför!" onClick="prefixCheck();">
</body>
</html>
Walk the streets, what do I see, Shit on legs approaching me!
Text
Du har ju ingen data i den i början. lägg in de 2 översta raderna i functionen som körs vid klick på "submit"-knappen.
<script type="text/javascript">
function prefixCheck() {
var cc = document.getElementById("cc").value
cc = parseInt(cc, 10);
if(cc<=659999 || cc>=304) {
alert("DinersClub not supported");
}while(cc=isNaN) {
alert("The input needs to be a number!");
break;
}
}
</script>
Du har ju ingen data i den i början. lägg in de 2 översta raderna i functionen som körs vid klick på "submit"-knappen.
<script type="text/javascript">
function prefixCheck() {
var cc = document.getElementById("cc").value
cc = parseInt(cc, 10);
if(cc<=659999 || cc>=304) {
alert("DinersClub not supported");
}while(cc=isNaN) {
alert("The input needs to be a number!");
break;
}
}
</script>
ah! Det har du helt rätt i! Tackar!
Walk the streets, what do I see, Shit on legs approaching me!
Copyright © 1999–2023 Geeks AB. Allt innehåll tillhör Geeks AB.
Citering är tillåten om källan anges.