hi,
i need help from you ^^ i don't now how to add java script into this programmed. the result should be come out with "you are interested in: (either one or all check box they click)". i hope you guys can help me on this.
Thank you ^^

<html>
<head>
<style type="text/css">

#apDiv1 {
	position:absolute;
	width:595px;
	height:298px;
	z-index:1;
	left: 412px;
	top: 38px;
}
-->
</style>
</head>
<title>safarina JavaScript</title>
<body align="center">

<div id="apDiv1">


<script type="text/javascript">

function MM_validateForm() { 
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
      if (val) { nm=val.name; if ((val=val.value)!="") {
        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
          if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
        } else if (test!='R') { num = parseFloat(val);
          if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
            min=test.substring(8,p); max=test.substring(p+1);
            if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
    } if (errors) alert('The following error(s) occurred:\n'+errors);
    document.MM_returnValue = (errors == '');
} }
</script>



<style type="text/css">

#apDiv1 {
	position:absolute;
	width:444px;
	height:185px;
	z-index:1;
	left: 348px;
	top: 37px;
	visibility: visible;
}

</style>

 
 <fieldset style="border-color:#999999">
   <form name="checkbox" method="get" action="" onSubmit="return comparision()" enctype = text/plain>
     <table width="452" border="0" cellpadding="0" cellspacing="0">
       <tr>
         <td width="117" scope="col"><div align="left">Name:</div></td>
         <th width="335" scope="col"><label> </label>
             <div align="left">
               <input name="name" type="text" id="name" onBlur="MM_validateForm('name','','R');return document.MM_returnValue" />
           </div></th>
       </tr>
       <tr>
         <td scope="row"><div align="left">Email Address:</div></td>
         <td><label>
           <input name="email" type="text" id="email" onBlur="MM_validateForm('email','','RisEmail');return document.MM_returnValue" />
           </label>
             <label>
             <input name="Validate" type="submit" id="Validate" onClick="MM_validateForm('name','','R','email','','RisEmail');return document.MM_returnValue" value="Validate" />
           </label></td>
       </tr>
     </table>
     <br />
     How can we help you?<br />
     <table width="452">
       <tr>
         <td width="43" height="28"><label>
           <input name="checkbox0" type="checkbox" />
         </label></td>
         <td width="397" scope="col">I'm interested in your programmes offered.</td>
       </tr>
       <tr>
         <td width="43" height="28"><label>
           <input name="checkbox1" type="checkbox" />
         </label></td>
         <td width="397" scope="col">I'm interested in short courses.</td>
       </tr>
       <tr>
         <td width="43" height="28"><label>
           <input name="checkbox2" type="checkbox"/>
         </label></td>
         <td width="397" scope="col">I'm interested in visiting your campus.</td>
       </tr>
     </table>
     <p>
     <input name="Reset" type="reset" tabindex="8">
       
     <input name="Submit" type="submit" id="Submit" value="Process"/>
     </p>
   </form>

 </fieldset>
</div>
</body>
</html>

You just copied someone else's script & page? Also, this script is very very very old because you no longer need to check for "document.getElementById" anymore.

What you need is to add another function called by your form on submit -- comparision() -- inside the script tag. The syntax of it should be similar to your function MM_validateForm(), but its definition will be whatever you want to compare...

thanks for replay,
no iam not copied with any person paper work. that code created by Adobe dreamweaver it self ^^ when i validate for name and email form. i have try to use java, but it failed to come out the result that i want. by the way, thanks a lot for your support ^^. iam very appreciate.

Hi,
i found the code already for my page ^^ yes this time i copied from internet ^^. thanks alot

<script type="text/javascript"> 
<!--
 
function get_check_value()
{
var c_value = "";
for (var i=0; i < document.checkbox.checkbox1.length; i++)
   {
   if (document.checkbox.checkbox1[i].checked)
      {
      c_value = c_value + document.checkbox.checkbox1[i].value + "\n";
      }
   }
c_value = "You interested in: " + c_value;
alert(c_value);
return false;
}
 
//-->
</script>
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.