<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script language="javascript">
function test(username) {
alert(username);
} function JInterval(funcName, time) {
var args = []; for (var i = 2; i < arguments.length; i++) {
args.push(arguments[i]);
}
return window.setInterval(function() {
funcName.apply(this, args);
}, time);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<input id="Button1" type="button" value="button" onclick="JInterval(test,1000,document.getElementById('TextBox1').value)" />
</div>
</form>
</body>
</html>
问题:
在textbox1里输入"1111",点button后可以各几秒弹出“1111”,但是再在textbox1里在输入2222时,点button后各几秒交替弹出"1111","2222",是什么原因呢?
<head runat="server">
<title></title>
<script language="javascript">
function test(username) {
alert(username);
} function JInterval(funcName, time) {
var args = []; for (var i = 2; i < arguments.length; i++) {
args.push(arguments[i]);
}
return window.setInterval(function() {
funcName.apply(this, args);
}, time);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<input id="Button1" type="button" value="button" onclick="JInterval(test,1000,document.getElementById('TextBox1').value)" />
</div>
</form>
</body>
</html>
问题:
在textbox1里输入"1111",点button后可以各几秒弹出“1111”,但是再在textbox1里在输入2222时,点button后各几秒交替弹出"1111","2222",是什么原因呢?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货