Hi all,

I had a problem with this html. Its name is index.asp.

<form action="index.asp" method="post">
<input type="submit" name="previous" value="prev">
<input type="submit" name="next" value="next">
</form>

The problems is,
I don't know whether i push the prev button or the next button.

How i will know that ?

--THanKs for yur help-- :)

Hi, i just want to know how to check the button i push.
So, i.e. if i push Prev Button, it will show "You push Prev button"
and if i push Next Button, it will show "You push Next button"

ps : Any related reply will be appreciated

Hi morecrab,

you could try this:

<form action="index.asy" method="post" onsubmit="return false;">
<div>
<input type="button" value="prev" onclick="alert('You\'ve pushed the ' + this.value + ' button');" /> <input type="button" value="next" onclick="alert('You\'ve pushed the ' + this.value + ' button');" />
</div>
</form>

Hi
You can check it via script.

<input type="submit" name="previous" value="prev" onclick='alert(this.name)'>
<input type="submit" name="next" value="next" onclick='alert(this.name)'>

Hi, i just want to know how to check the button i push.
So, i.e. if i push Prev Button, it will show "You push Prev button"
and if i push Next Button, it will show "You push Next button"

ps : Any related reply will be appreciated

Hi, I suspect that you want to identify the button you pressed inside your index.asp script.

If so, you must send the value in the post request. To do it just add a hidden field and modify the value any time you press one of the buttons. Your code should look like:

<form action="index.asp" method="post">
<input type="hidden" name="buttonpressed" value="" />
<input type="submit" name="previous" value="prev" onclick="document.forms[0].buttonpressed.value='prev'">
<input type="submit" name="next" value="next" onclick="document.forms[0].buttonpressed.value='next'">
</form>

now, you can check for the value of the field buttonpressed in your ASP script.

HTH


.::AleX::.

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.