<%@ Page Language="C#" AutoEventWireup="true" CodeFile="3-19.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<script type="text/javascript">
document.write("asd");
function neirong(){
x = document.getElementById("demo"); //找到元素
x.innerHTML = "是吧!"; //改变内容
}
function yanse() {
x = document.getElementById("demo"); //找到元素
x.style.color = "red"; //改变样式
}
function yanzheng() {
var x = document.getElementById("txtyz").value;
if (x == "" || isNaN(x))
{
alert("非数值")
}
}
function tupian() {
Element = document.getElementById('youxihou')
if (Element.src.match("youxi2")) {
Element.src = "Image/youxi.gif";
}
else {
Element.src = "Image/youxi2.gif";
}
}
function xiaoshi() {
document.write("消失了");
}
function xianshi() {
var name = "显示内容";
document.getElementById("demo2").innerHTML = name;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<button type="button" οnclick="alert('Welcome to ShangHai')">点击弹出</button>
</div>
<p id="demo">
这行马上被替换!
</p>
<button type="button" οnclick="neirong()">替换内容</button>
<button type="button" οnclick="yanse()">替换样式</button>
<input type="text" id="txtyz" ></input>
<button type="button" οnclick="yanzheng()">验证</button>
<img id="youxihou" οnclick="tupian()" src="Image/youxi.gif" />单击图片
<button οnclick="xiaoshi()">点击消失</button>
<button οnclick="xianshi()">点击显示</button>
<p id="demo2"></p>
</form>
</body>
</html>