I have a page where I have to print only div content, this content is dynamic and will vary based on drop downvalue. Now, i want to print this content, I was able to do it successfully using
function printDiv(divId){
var orginalPage= document.body.innerHTML;
var printDiv= document.getElementById(divId).innerHTML;
document.body.innerHTML = printDiv;
window.print();
document.body.innerHTML = orginalPage;
}
but my problem is, when I am done printing the div and get back to actual page the dropdown value is getting reseting to default value. I want the value to be same as value which was selected before printing div.. for example I selected "xyz" from dropdown then after printing my div content I want xyz to be selected by default.
I will be iterating a list for this dropdown options. something like this
<select id="reason" >
<logic:iterate id="hs" name="hslist" type="hsData">
<option value="">select a reason </option>
<option value="<bean write name='hs' property='hsReasonId'/>">
<bean write name="hs" property="hsReasonDesc"/></option>
</logic>
</select>
Can someone help in fixing this...