js实现按钮
例子
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>js-test</title>
<script type="text/javascript">
alert('hello');
</script>
</head>
<body>
It's a js test!
***<input type="button" name="" value="弹框" onclick="alert('恭喜你,点开了!')">***
</body>
</html>
关闭窗口的方法:window.close();可以加在script里面
向body中写入信息:document.write()
模块化:新建hello.js
function welcome(str1,str2,str3) {
alert(str1);
<!--window.close();-->
document.write(str2+'<br/>');
document.write(str3);
}
先引入hello.js模块,调用里面的welcome函数,
<input type="button" name="" value="弹框" onclick="welcome('hello','welcome you','等你很久了!');"/>
传参数调用!