473,385 Members | 1,893 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Javascript Yes/No

Hi there,

I have searched for some examples, but to no real avail, for a JS function
that displays a user Yes/No dialog box.
Basically, i have an ASP application that displays a SQL table on an ASP
page.

I have created a "Remove" hyperlink (in a loop) by each record and i need to
use an OnClick event so when the user clicks this hyperlink it displays this
Yes/No dialog.
At the moment the hyperlink simply removes the relevant record.

I need an OnClick event that displays a Yes/No box that when the user clicks
Yes - it goes to remove.asp, and when No is clicked it does nothing.

User Clicks Remove next to record > Yes/No dialog> Yes = remove.asp No =
End.

*****
*****
Current Hyperlink (passing ID variable in querystring - needs to be
maintained through the javascript:

<a href="remove.asp?ID=<% =server.URLEncode(RS("ID"))%>">Remove</a>
*****
*****

Any code/help would be much appreciated.
Thanks

--
Thanks in advance

Fawke

Please remove ANTI and SPAM
from my email address before emailing me.

www.bradflack.com
Jul 19 '05 #1
12 9091
Fawke101 wrote:
Hi there,

I have searched for some examples, but to no real avail, for a JS function
that displays a user Yes/No dialog box.
Basically, i have an ASP application that displays a SQL table on an ASP
page.

I have created a "Remove" hyperlink (in a loop) by each record and i need to
use an OnClick event so when the user clicks this hyperlink it displays this
Yes/No dialog.
At the moment the hyperlink simply removes the relevant record.

I need an OnClick event that displays a Yes/No box that when the user clicks
Yes - it goes to remove.asp, and when No is clicked it does nothing.

User Clicks Remove next to record > Yes/No dialog> Yes = remove.asp No =
End.

*****
*****
Current Hyperlink (passing ID variable in querystring - needs to be
maintained through the javascript:

<a href="remove.asp?ID=<% =server.URLEncode(RS("ID"))%>">Remove</a>
*****
*****


<a href="#" onclick="customConfirm('remove.asp?ID=<%
=server.URLEncode(RS("ID"))%>');return false">Remove</a>

customConfirm would be a function that accepts the URL as a parameter,
then shows a DIV in the center of the screen with two buttons. The
buttons would have onclicks that when clicked, would either do nothing
(the NO button) or set location.href to the remove.asp page.


--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/
Jul 19 '05 #2
Thanks for your prompt reply......
Sorry to be a pain, i am no JS developer, Any examples of this?

Thanks so much
--
Thanks in advance

Fawke

Please remove ANTI and SPAM
from my email address before emailing me.

www.bradflack.com
"Randy Webb" <hi************@aol.com> wrote in message
news:kv********************@comcast.com...
Fawke101 wrote:
Hi there,

I have searched for some examples, but to no real avail, for a JS function that displays a user Yes/No dialog box.
Basically, i have an ASP application that displays a SQL table on an ASP
page.

I have created a "Remove" hyperlink (in a loop) by each record and i need to use an OnClick event so when the user clicks this hyperlink it displays this Yes/No dialog.
At the moment the hyperlink simply removes the relevant record.

I need an OnClick event that displays a Yes/No box that when the user clicks Yes - it goes to remove.asp, and when No is clicked it does nothing.

User Clicks Remove next to record > Yes/No dialog> Yes = remove.asp No =
End.

*****
*****
Current Hyperlink (passing ID variable in querystring - needs to be
maintained through the javascript:

<a href="remove.asp?ID=<% =server.URLEncode(RS("ID"))%>">Remove</a>
*****
*****


<a href="#" onclick="customConfirm('remove.asp?ID=<%
=server.URLEncode(RS("ID"))%>');return false">Remove</a>

customConfirm would be a function that accepts the URL as a parameter,
then shows a DIV in the center of the screen with two buttons. The
buttons would have onclicks that when clicked, would either do nothing
(the NO button) or set location.href to the remove.asp page.


--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/

Jul 19 '05 #3
Would a confirm dialog be OK ?
You can't chnage the button text, but the meaning is clear.

if(confirm("You want this ?"))
alert("yes")
else
alert("No")
Jul 19 '05 #4
<a href="remove.asp?ID=<% =server.URLEncode(RS("ID"))%>"
onClick="confirm('Are you sure?');">Remove</a>

It's not really an ASP question.

"Fawke101" <gu*@ANTIbradflack.SPAMcom> wrote in message
news:O8**************@TK2MSFTNGP09.phx.gbl...
Hi there,

I have searched for some examples, but to no real avail, for a JS function
that displays a user Yes/No dialog box.
Basically, i have an ASP application that displays a SQL table on an ASP
page.

I have created a "Remove" hyperlink (in a loop) by each record and i need to use an OnClick event so when the user clicks this hyperlink it displays this Yes/No dialog.
At the moment the hyperlink simply removes the relevant record.

I need an OnClick event that displays a Yes/No box that when the user clicks Yes - it goes to remove.asp, and when No is clicked it does nothing.

User Clicks Remove next to record > Yes/No dialog> Yes = remove.asp No =
End.

*****
*****
Current Hyperlink (passing ID variable in querystring - needs to be
maintained through the javascript:

<a href="remove.asp?ID=<% =server.URLEncode(RS("ID"))%>">Remove</a>
*****
*****

Any code/help would be much appreciated.
Thanks

--
Thanks in advance

Fawke

Please remove ANTI and SPAM
from my email address before emailing me.

www.bradflack.com

Jul 19 '05 #5
A confirm would be fine.......

I just wouldnt mind knowing how to incorporate this into my ASP -

Do you want this?
Yes -goto remove.asp
No - -*nothing*

How can i incorporate this JS into my code (sorry, i am not clued up with
JS at all)

--
Thanks in advance

Fawke

Please remove ANTI and SPAM
from my email address before emailing me.

www.bradflack.com
"Saint Jude" <th**************@hotmail.com> wrote in message
news:e7****************@TK2MSFTNGP09.phx.gbl...
Would a confirm dialog be OK ?
You can't chnage the button text, but the meaning is clear.

if(confirm("You want this ?"))
alert("yes")
else
alert("No")

Jul 19 '05 #6
Fawke101 wrote:
A confirm would be fine.......

I just wouldnt mind knowing how to incorporate this into my ASP -

Do you want this?
Yes -goto remove.asp
No - -*nothing*

How can i incorporate this JS into my code (sorry, i am not clued up with
JS at all)


<a href="URL" onclick="return confirm('Are you sure you want to remove
this item?')">Remove</a>

If they click OK, it returns True and the link is navigated to. If they
click cancel, the confirm returns false and the href is not followed.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/
Jul 19 '05 #7
Perfect! Big Thanks!

--
Thanks in advance

Fawke

Please remove ANTI and SPAM
from my email address before emailing me.

www.bradflack.com
"TomB" <sh*****@hotmailXXX.com> wrote in message
news:O3**************@TK2MSFTNGP12.phx.gbl...
<a href="remove.asp?ID=<% =server.URLEncode(RS("ID"))%>"
onClick="confirm('Are you sure?');">Remove</a>

It's not really an ASP question.

"Fawke101" <gu*@ANTIbradflack.SPAMcom> wrote in message
news:O8**************@TK2MSFTNGP09.phx.gbl...
Hi there,

I have searched for some examples, but to no real avail, for a JS function that displays a user Yes/No dialog box.
Basically, i have an ASP application that displays a SQL table on an ASP
page.

I have created a "Remove" hyperlink (in a loop) by each record and i
need to
use an OnClick event so when the user clicks this hyperlink it displays

this
Yes/No dialog.
At the moment the hyperlink simply removes the relevant record.

I need an OnClick event that displays a Yes/No box that when the user

clicks
Yes - it goes to remove.asp, and when No is clicked it does nothing.

User Clicks Remove next to record > Yes/No dialog> Yes = remove.asp No =
End.

*****
*****
Current Hyperlink (passing ID variable in querystring - needs to be
maintained through the javascript:

<a href="remove.asp?ID=<% =server.URLEncode(RS("ID"))%>">Remove</a>
*****
*****

Any code/help would be much appreciated.
Thanks

--
Thanks in advance

Fawke

Please remove ANTI and SPAM
from my email address before emailing me.

www.bradflack.com


Jul 19 '05 #8
TomB wrote:
<a href="remove.asp?ID=<% =server.URLEncode(RS("ID"))%>"
onClick="confirm('Are you sure?');">Remove</a>

It's not really an ASP question.


Shouldn't that be this?

...onclick="return confirm('Are you sure?')"...
^^^^^^^

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 19 '05 #9
Dave Anderson wrote:
TomB wrote:
<a href="remove.asp?ID=<% =server.URLEncode(RS("ID"))%>"
onClick="confirm('Are you sure?');">Remove</a>

It's not really an ASP question.

Shouldn't that be this?

...onclick="return confirm('Are you sure?')"...
^^^^^^^


Yes, it should be. Otherwise its pointless to have it.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/
Jul 19 '05 #10
Oops

"Dave Anderson" <GT**********@spammotel.com> wrote in message
news:ei*************@TK2MSFTNGP10.phx.gbl...
TomB wrote:
<a href="remove.asp?ID=<% =server.URLEncode(RS("ID"))%>"
onClick="confirm('Are you sure?');">Remove</a>

It's not really an ASP question.
Shouldn't that be this?

...onclick="return confirm('Are you sure?')"...
^^^^^^^

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message.

Use of this email address implies consent to these terms. Please do not contact me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.

Jul 19 '05 #11

I don't get it to work, it transfers me right away to the url, an
doesn't display a confirm window at all.
TomB wrote:
*Oops

"Dave Anderson" <GT**********@spammotel.com> wrote in message
news:ei*************@TK2MSFTNGP10.phx.gbl...
TomB wrote:

Shouldn't that be this?

...onclick="return confirm('Are you sure?')"...
^^^^^^^

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 pe

message.
Use
of this email address implies consent to these terms. Please d

not
contact
me directly or ask me to contact you directly for assistance. I

your
question is worth asking, it's worth posting.

-
matt
-----------------------------------------------------------------------
Posted via http://www.codecomments.co
-----------------------------------------------------------------------

Jul 19 '05 #12
mattm wrote:

Shouldn't that be this?

...onclick="return confirm('Are you sure?')"...
^^^^^^^

...


I don't get it to work, it transfers me right away to the url,
and doesn't display a confirm window at all.


That's the point of returning a value -- to avoid the very problem you are
experiencing. Please review the above carefully.

If you would like something a bit more enlightening than formulaic, try the
following:

<A HREF="" ONCLICK="return false">Click here</A>

Observe its behavior. Now modify it slightly:

<A HREF="" ONCLICK="confirm('Really?');return false">Click here</A>

Again, observe the behavior. Last of all, go back to the structure of my
original suggestion, and see what it does:

<A HREF="" ONCLICK="return confirm('Really?')">Click here</A>

Now you should understand what you are doing wrong.

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 19 '05 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.