JS基礎学習
991 ワード
1.js原名livescriptとjavaの関係は多くない
livescript->javascript[javaとjavascriptは何の関係もありません]
jscriptはマイクロソフトの製品ですがjavascriptの文法規範と一致しています.
2.初体験:ボタンをクリックしてdiv色を設定
livescript->javascript[javaとjavascriptは何の関係もありません]
jscriptはマイクロソフトの製品ですがjavascriptの文法規範と一致しています.
2.初体験:ボタンをクリックしてdiv色を設定
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<!-- js -->
<script language="javascript">
function test1(){
//
//1. div1
var mydiv1=document.getElementById("div1");
mydiv1.style.background="red";
}
function test2(){
//
//1. div1
var mydiv1=document.getElementById("div1");
mydiv1.style.background="black";
}
</script>
</head>
<input type="button" value=" " onclick="test1()"/>
<input type="button" value=" " onclick="test2()"/>
<div id="div1" style="width:400px;height:300;background-color:blue">
hello
</div>
hello,world
</html>