<!DOCTYPE html>
<html>
<head>
<title>js6.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
<script type="text/javascript">
function fun()
{
var light=document.getElementById("light");
light.src="../Img/img.jpg";
}
</script>
</head>
<body>
<img id="light" src="../Img/image.jpg" onclick="fun();">
<h1 id ="title"> 中国地质大学 </h1>
<script type="text/javascript">
var light=document.getElementById("light");
alert("切换背景");
light.src="../Img/img.jpg";
var title=document.getElementById("title");
alert("切换标题");
title.innerHTML ="中国";
</script>
This is my HTML page. <br>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>js7.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
</head>
<body>
<img id= "light" src="../Img/image.jpg" onclick="">
<script>
var light=document.getElementById("light");
var f= false;
light.onclick= function()
{
if(f)
{
light.src="../Img/image.jpg" ;
f=false;
}
else
{
light.src="../Img/img.jpg" ;
f=true;
}
}
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>js8.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
</head>
<body>
<input type="button" id="back" value="后退">
<script type="text/javascript">
window.alert("Hello world!");
var b=confirm("需要退出吗?");
if(b)
{
alert("点击了确认");
}else
{
alert("点击了取消");
}
var value=prompt("输入用户名");
var btn2=document.getElementById("back");
btn2.onclick=function()
{
history.back();
}
</script>
</body>
</html>
