JavaScript学习日记

<html>
<head>
<title>Script学习</title>
<link rel='stylesheet' type='text/css' href='mystyle.css'>
<script type="text/javascript" src="my.js" ></script>
</head>
<body id='body'>
<script>
<!-- document.write('Helloworld'); -->
document.write("<p align='center'>"+person['age']+'</p>')
<!-- document.getElementById('shuchu1').innerHTML=person['name'] -->
document.write("<p align='center'>"+obj.name+'</p>')
<!-- document.getElementById('shuchu2').innerHTML=obj.name -->
function mouse(id){

id.innerHTML=alert('你好')
}

</script>
<div align='center' id='div1'>
<div>

<p id='shuchu1'></p>
<p id='shuchu2'></p>
<h2 onclick="this.innerHTML='鼠标移动到这里了'">JavaScript学习记录</h2>
<input type="text" id="fname" onmouseout ="mouse(this)">
<br/>
<button type='button' onclick='alert("welcome")'>点击这里</button>
<button type='button' onclick='creatElmentNode()'>创建节点</button>
<button type='button' onclick='removeElmentNode()'>删除节点</button>
<!-- <script>
alert('Welcome')
</script> -->

</div>
<br/>
<br/>
<button type='button' onclick='add(5,10)'>带参函数</button>

<p id='Demo01'>你好我在测试数据</p>
<button type='button' onclick='myfunction()'>我点击后标签p内容改变</button>
<!-- <div id='content'></div> -->
<button type='button' onclick='s()'>循环内容</button>
<button type='button' onclick='message()'>发生错误</button>
<button type='button' onclick="myerro('X')">发生自定义错误</button>
<button type='button' onclick='changeimage()'>改变标签的属性</button>
<br/>
<button type='button' onclick='changebody()'>改变标签的css</button>
<!-- <script>
function myfunction(){
document.getElementById('Demo01').innerHTML='我的数据是你好'
}
</script> -->
<!-- 如需从 JavaScript 访问某个 HTML 元素,您可以使用 document.getElementById(id) 方法。
请使用 "id" 属性来标识 HTML 元素: -->

</div>
<div>
<img id='img01' src="source/bodybeijin.jpg">
</div>
</body>
</html>

posted @ 2020-11-13 22:40  zakeapx  阅读(48)  评论(0)    收藏  举报