HTML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Try It Free
Go Back   Dev Shed ForumsWeb DesignHTML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 28th, 2000, 06:55 AM
peterbe peterbe is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2000
Posts: 58 peterbe User rank is Private First Class (20 - 50 Reputation Level)peterbe User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
I want that - when people tick a checkbox for Delete in a form - that a confirm screen pops up to verify their choice.
I begin by testing with confirm() and if it's 'true' then check the box they chose.
If not true, then uncheck the box they chose.

How do you UNcheck a checkbox box?

Code:
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre><script language="JavaScript">
<!--
function Delmsg(productID,product_description,fieldname) {
var msg;
msg = "---------------------------------------- Caution message --------------------------------------------nnn";
msg += "Are you sure you want to delete this one?nnproductID:tt ";
msg += productID;
msg += "nproduct_description:t";
msg += product_description;
msg += "nnn---------------------------------------- Caution message -------------------------------------------n";

if (confirm(msg)) {
document.change_product.fieldname.checked;
} else {
!document.change_product.fieldname.checked;
}
//alert(msg);
}
-->
</script>[/code]

Call:
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre><input type=checkbox name=delete_0 value="500NO" onClick="javascript elmsg('500NO','Single Computer, 500K','delete_0')">[/code]

------------------

¬ peterbe.com ¬

Reply With Quote
  #2  
Old July 28th, 2000, 09:40 AM
peterbe peterbe is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2000
Posts: 58 peterbe User rank is Private First Class (20 - 50 Reputation Level)peterbe User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Found it!

<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
<script>
var box;
box = eval("document.change_product."+fieldname);

if (box.checked != true) {
box.checked = false;
} else {
if (!confirm(msg)) {
box.checked = false;
}
}</script>
[/code]

------------------

¬ peterbe.com ¬

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignHTML Programming > Check and uncheck checkboxes


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway