[FX.php List] [OFF] A Javascript question
Head Honcho
headhoncho at customikesolutions.com
Wed Apr 22 18:06:09 MDT 2009
Hi Bob,
On 23/04/2009, at 8:55 AM, Bob Patin wrote:
> I have a Javascript question:
>
> I have a table that builds rows, each of which with a checkbox.
>
> There are 2 checkbox rows that I want to monitor, and if they check
> either of them, show an alert to them.
>
<snip />
If it were me, I'd be doing it with jQuery.
Here's the full page (sorry about the inline post, I've forgotten the
link to the web page to display code snippets)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script src="jquery.js" type="text/javascript" charset="utf-8"></
script>
<title>checkboxes</title>
<script type="text/javascript" charset="utf-8">
$(function(){
$(".aCheckbox").click(function(){
if($(this).is(':checked')){
alert("checkbox "+this.name + "\nHas a value of "+$(this).val());
}
});
});
</script>
</head>
<body>
<form action="checkboxes.html" method="post" accept-charset="utf-8">
<input type="checkbox" name="thisName" value="1" class =
"aCheckbox"> Checkbox 1
<input type="checkbox" name="thisName1" value="2" class =
"aCheckbox"> Checkbox 2
<input type="checkbox" name="thisName2" value="3" class =
"aCheckbox"> Checkbox 3
<input type="checkbox" name="thisName3" value="4" class =
"aCheckbox"> Checkbox 4
</form>
</body>
</html>
You can see this in action at <http:demo.customikesolutions.com/
checkboxes.html>
if you expand your list of checkboxes, you just need to give them a
class of "aCheckbox" (or whatever you call it) and it will "just work".
Hope this helps.
Regards
Michael Ward
--
Head Honcho
CustoMike Solutions
Member, FileMaker Business Alliance
Member, FileMaker Technical Network
FileMaker 7 Certified Developer
FileMaker 8 Certified Developer
FileMaker 9 Certified Developer
10 Wandoo Crt
Wheelers Hill, 3150
ph 0414 562 501
headhoncho at customikesolutions.com
More information about the FX.php_List
mailing list