console
function my() {
document.getElementById('h1').style.color = 'red';
}
function my_1() {
var val = document.getElementById('input').value;
if (val == '') {
alert('请输入内容');
} else if (isNaN(val)) {
alert('输入的不是数字');
}
}
function my2(){
document.getElementById('p3').innerHTML='新数据';
}
var str =" ddd";
document.write( str.toUpperCase());
}
var obj={
first : "111",
second : '222',
third : '333'
};
document.write(obj.first+'<br/>');
person=new Object();
person.name="Tom";
person.sex="male";
person.age="22";
document.write(person.name+' is a '+ person.age+" "+ person.sex);
<div>
<h1 id="h1">
js入门
</h1>
<button id="btn" class="btn" onclick="my()">
click
</button>
</div>
<div>
<input type="text" id="input" />
<button onclick="my_1()">
click
</button>
</div>
<div>
<p id='p3'>原数据</p>
<button onclick="my2()">click</button>
</div>
<div>
<p>toUpperCase转大写</p>
<p id="pp">hello world</p>
<p id="p4"></p>
<button onclick=my3()>click</button>
</div>