faqts : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

34 of 51 people (67%) answered Yes
Recently 7 of 10 people (70%) answered Yes

Entry

How can I use checkboxes to designate the recipients of a form and have it sent using the forms ACTION=mailto function.

Apr 4th, 2008 20:45
ha mo, Knud van Eeden, Ovidiu Crisan, David Womack,


<html>
<head><script language=JavaScript>
//Ovidiu Crisan http://vbwork.4mg.com
var addresses=Array
("Address1","Address2","Address3","Address4","Address5");
function email() {
var s='';
for(i=0;i<document.forms['frm'].length;i++)
  if(document.forms['frm'].elements[i].type == 'checkbox')
    if(document.forms['frm'].elements[i].checked) s=s+addresses[i]+",";
if(s != '') window.open("mailto:"+s+"?Subject=test&Body=test%20test")
}
</script></head>
<body><form name=frm>
<script language=JavaScript>
for(i=0;i<addresses.length;i++)
document.write("<input type=checkbox>"+addresses[i]+"<br>");
</script>
<input type=button value="Email!" onclick="email();">
</form></body></html>
-----------------------------------------------------------------------
--- Knud van Eeden - 18 September 2001 - 03:57 ------------------------
[Internet: see also: 
http://www.faqts.com/knowledge_base/view.phtml/aid/10599/fid/53]
-----------------------------------------------------------------------
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com