임호준

0425 자바스크립트 실습

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>practice10</title>
</head>
<body>
<input type="text" name="" value="" id="input1">
<input type="button" name="" value="입력" onclick="call()">
<div id = "div1">
</div>
<script type="text/javascript">
function call(){
// var birth = prompt("생년월일을 입력해주세요","6자리 입력");
var birth = document.getElementById("input1").value;
if(birth!=""){
var temp= document.getElementById("div1");
var a = birth.substr(0,2);
var b = birth.substr(2,2);
var c = birth.substr(4,2);
//temp.innerHTML = birth.length;
temp.innerHTML = "생일:19"+a+"년 "+b+"월 "+c+"일";
}
}
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>practice10</title>
</head>
<body>
학점:
<input type="text" name="" value="" id="input1">
<input type="button" name="" value="입력" onclick="call()">
<div id = "div1">
</div>
<script type="text/javascript">
function call(){
var score = document.getElementById("input1").value;
if(score!=""){
var temp= document.getElementById("div1");
if(score>= 90){
temp.innerHTML = "<h1>your grade is A</h1> ";
}else if(score>=80 &&score<=89){
temp.innerHTML = "<h1>your grade is B</h1> ";
}else if(score>=70 &&score<=79){
temp.innerHTML = "<h1>your grade is C</h1> ";
}else{
temp.innerHTML = "<h1>your grade is F</h1> ";
}
}
}
</script>
</body>
</html>
var sum = 0;
for(var i = 1; i <= 5; i++){
sum+=i;
}
console.log(sum/5);
var a = "1";
var b = 2;
console.log(a+b);
var _a = 1;
var _b = 2;
console.log(_a+_b);
console.log(parseFloat("23FF2"))