<input name="btnCetak" type="submit" class="buttonPaging" style="width:200px;" value="Kemaskini Tarikh Serahan" onclick="document.pressed=this.value" />
<input name="export" type="submit" class="buttonPaging" value="Surat Akuan" onclick="document.pressed=this.value" />
The above is my 2 different buttons. The below code is my script function, chkCheckBox
.
function chkCheckBox()
{
if(document.pressed=="Surat Akuan")
{
var a=new Array();
a=document.getElementsByName("chkCetak[]");
var p=0;
for(i=0;i<a.length;i++)
{
if(a[i].checked)
p=1;
}
if (p==0)
{
alert('Sila pilih Nama Pemohon.');
return false;
}
else
{
var total=""
for(var x=0; x< document.myForm.elements['chkCetak[]'].length;x++)
{
if(document.myForm.elements['chkCetak[]'][x].checked)
total +=document.myForm.elements['chkCetak[]'][x].value + "\n"
}
if(total=="")
{
}
else
{
document.myForm.submit();
return true;
}
}
}
}
chkCheckBox
works. My question is: How do I want to redirect to the other page when the "Surat Akuan" button is clicked?