<HTML>
<BODY topmargin='2' leftmargin='2'>
<SCRIPT language='Jscript'>
function Add()
{
if(window.document.all['txt'].value =="")
{
window.document.all['txt'].value = 0;
}
window.document.all['txt'].value = parseInt(window.document.all['txt'].value) +1;
}
</SCRIPT>
<input type="image" src="./ttt.jpg" onclick="Add()">
<input type='text' name='txt' value='' >
</BODY>
</HTML>
<BODY topmargin='2' leftmargin='2'>
<SCRIPT language='Jscript'>
function Add()
{
if(window.document.all['txt'].value =="")
{
window.document.all['txt'].value = 0;
}
window.document.all['txt'].value = parseInt(window.document.all['txt'].value) +1;
}
</SCRIPT>
<input type="image" src="./ttt.jpg" onclick="Add()">
<input type='text' name='txt' value='' >
</BODY>
</HTML>
我就纳闷了
我的textbox和img都放在一个table里面的。应该没什么关系吧。
Assembly="Microsoft.Web.UI.WebControls" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>WebForm3</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.0">
<meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<SCRIPT language='javascript'>
function Add()
{
if(window.document.all['txt'].value =="")
{
window.document.all['txt'].value = 0;
}
window.document.all['txt'].value = parseInt(window.document.all['txt'].value) +1;
}
</SCRIPT> <body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<input type="image" src="../../images/update-note.gif" onclick="Add()">
<input type='text' name='txt' value='' >
</form>
</body>
</HTML>用的是VB.net,WEBFROM。
{
if(window.document.all['txt'].value =="")
{
window.document.all['txt'].value = 0;
}
window.document.all['txt'].value = parseInt(window.document.all['txt'].value) +1;
return false;
}
</SCRIPT><input type="image" src="../../images/update-note.gif" onclick="return Add();">你把所有不愿意刷新的按钮上的事件都加上 return ,调用的事件都返回false就肯定不会刷新了。