I want to call a JavaScript function depending on the check boxes status.
For example if only checkbox 1 is active, I want to call the function genPDF()
If all checkboxes are active I want to invoke the function gen4PDF()
once I press the generate report button, etc.
As far as I know I can do something like that: (and it works) <a href="javascript:genPDF()"> DOWNLOAD PDF </a>
But I want a more 'smart' link/button. How can I do it?
Thank you guys.
My code skeleton:
<!DOCTYPE>
<html>
<head>
<title>System Overview Report</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<script type="text/javascript" src="jspdf.min.js"></script>
<script type="text/javascript">
function genPDF(){
}
function gen2PDF(){
}
function gen3PDF(){
}
function gen4PDF(){
}
</script>
</head>
<body>
<input type="checkbox" name="basic">I want basic report<br>
<input type="checkbox" name="network">I want network report<br>
<input type="checkbox" name="suggestions">I want suggestions report<br>
<input type="checkbox" name="complete">I want a complete report
<a href="javascript:genPDF()"> GENERATE PDF REPORT </a>
</body>
</html>
Aucun commentaire:
Enregistrer un commentaire