hi plz tell me how to increment textbox value by 1 whenever click submit button in asp.Example let say now my text box value is 1.When user click submit the text box value must change to 2 and so on.Plz reply me. thanx in advance;)

sorry, continued.

<script language="JavaScript">
function addone(){
textbox1.value=eval(textbox1.value + 1)
form1.submit()
}</script>
<form method="post" action="somepage.asp" onSubmit="addone()"><input type="text" name="textbox1"><input type="submit" value="submit"></form>

Or more like:

<script language="JavaScript">
function addone(){
textbox1.value=eval(textbox1.value + 1)
}</script>
<input type="text" name="textbox1"><input type="Button" value="submit" onClick="addone()"></form>

sorry, continued.

<script language="JavaScript">
function addone(){
textbox1.value=eval(textbox1.value + 1)
form1.submit()
}</script>
<form method="post" action="somepage.asp" onSubmit="addone()"><input type="text" name="textbox1"><input type="submit" value="submit"></form>

Or more like:

<script language="JavaScript">
function addone(){
textbox1.value=eval(textbox1.value + 1)
}</script>
<input type="text" name="textbox1"><input type="Button" value="submit" onClick="addone()"></form>

Hi thanx for ur response.Its really helpful.But now I,m facing another problem.Im having one combobox.Once user choose item in combobox, the selected item must be display in textbox with an autonumber.For example:
If combobox value is A.textbox value must be A1.Once user submit,and user choose another item in combobox the item (let say B) textbox must display B2.hope u understand my question.Thanx in advance.Plz post me as soon as possible.Because I need to finish tis function as earlier as possible.

I think this will do it. Tell me what you think...

<html><head>
<script language="JavaScript">
function addone(){
form1.counter1.value=eval(form1.counter1.value) + 1
form1.submit()
}</script>
</head><body>
<%
countsofar = CInt(Request("counter1"))
ddselected = CStr(Request("dropdown1"))
textbox1now = ddselected & countsofar
%>
<form method="post" action="test.asp" name="form1">
<select name="dropdown1">
<option value="a" <%if ddselected="a" then response.write("selected") end if%>>a</option>
<option value="b" <%if ddselected="b" then response.write("selected") end if%>>b</option>
<option value="c" <%if ddselected="c" then response.write("selected") end if%>>c</option>
</select>
<input type="text" name="textbox1" value="<%=textbox1now%>">
<input type="hidden" name="counter1" value="<%=countsofar%>">
<input type="button" value="submit" onClick="addone()">
</form>
</body></html>

hi plz tell me how to increment textbox value by 1 whenever click submit button in asp.Example let say now my text box value is 1.When user click submit the text box value must change to 2 and so on.Plz reply me. thanx in advance;)[/quote


iam sending the coding copy pste in ur applcation

function ChkZero(x) { if(x == "") return 0; else return x; }
function calc(el1,el2,el3,el4) { var a = ChkZero(eval("document.frmansadd."+el1).value); var b = ChkZero(eval("document.frmansadd."+el2).value); var c = ChkZero(eval("document.frmansadd."+el3).value); d = parseInt(a)+parseInt(b)+parseInt(c) eval("document.frmansadd."+el4).value=d; }

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.