点击弹窗提醒
1.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script>
function myFunction(){
alert("你好,我是一个警告框!");
}
</script>
</head>
<body>
<input type="button" onclick="myFunction()" value="显示警告框" />
</body>
</html>
2.target
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body>
默认是打开新的页面
<a href="http://www.runoob.com">访问菜鸟教程!</a>
打开新的页面
<a href="http://www.runoob.com" target="_blank">访问菜鸟教程!</a>
在这个页面打开
<a href="http://www.runoob.com" target="_parent">访问菜鸟教程!</a> 在
</body>
</html>
3.onclick
语法 <element onclick="script">
对于链接也是同样适用的
<a onclick="copyText()">复制文本</a>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
<script>
function copyText()
{
alert("你好,我是一个警告框!");
}
</script>
</head>
<body>
<a onclick="copyText()">复制文本</a>
</body>
</html>