I am trying to print a specific part of a webpage. But whenever I try to print it, it doesn't show the radio button I have selected, what's in a text box or what I have selected from the drop down menu. Can you please tell me how can I achieve this in the following code
<html>
<head>
<script>
printDivCSS = new String ('<link href="myprintstyle.css" rel="stylesheet" type="text/css">')
function printDiv(divId) {
window.frames["print_frame"].document.body.innerHTML=printDivCSS + document.getElementById(divId).innerHTML;
window.frames["print_frame"].window.focus();
window.frames["print_frame"].window.print();
}
</script>
</head>
<body>
<p>Some information that doesn't need to be printed</p>
<div id="div1">This is the Part that need to be printed<br>
<input type="radio" name="gender" value="male"> Male<br>
<input type="radio" name="gender" value="female"> Female<br>
<input type="radio" name="gender" value="other"> Other
<br>
<select>
<option value="empty"> </option>
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="opel">Opel</option>
<option value="audi">Audi</option>
</select>
<p>Print out need to show the gender and the car brand I have selected</p>
</div>
<iframe name="print_frame" width="0" height="0" frameborder="0" src="about:blank"></iframe>
<b>Click here to Print:</b> <a href="javascript:printDiv('div1')">Print</a><br>
</body>
</html>
Please show me with an example code if possible