<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>

解决方案 »

  1.   

    parseInt(window.document.all['txt'].value) +1
      

  2.   

    to: liu76xt((网事随逢)) 点击image的时候,页面刷新了啊,还有什么原因会导致页面刷新的?
      

  3.   

    我用图片了,一张.gif的,一张.ico的,都这样。
    我就纳闷了
      

  4.   

    会不会是其他原因导致页面刷新的?
    我的textbox和img都放在一个table里面的。应该没什么关系吧。
      

  5.   

    <%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm3.aspx.vb" Inherits="Web.WebForm3"%>
    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。
      

  6.   

    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;
     return false;
    }
    </SCRIPT><input type="image"  src="../../images/update-note.gif" onclick="return Add();">你把所有不愿意刷新的按钮上的事件都加上 return ,调用的事件都返回false就肯定不会刷新了。