I am creating a review screen for a form. The code writes to a new window, and I want to unhide certain div sections based on a dropdown selection. I'm having trouble getting the code to work because the <div> tags are in the code being writen to the new window. Here's my (sample) code:
I'm just trying to hide it to begin with, but I get a "'revEmp' is undefined" error. How do I tell it that the ID named 'revEmp' is in the new window?
Code:
function fieldReview() {
var newWindow = window.open("", "", "HEIGHT=200,WIDTH=250,resizable=1");
d = document.NewUser;
dept = d.Department.value;
var rl = document.getElementById(dept).value;
document.getElementById(revEmp).style.display='none';
t = d.Type.value;
newWindow.document.write("<body bgcolor='#D6E1EB' text='#87a7c5'><font face='Arial, Helvetica, sans-serif'>First Name:<b> " + d.ufname.value + "</b><br>Last Name:<b> " + d.ulname.value + "</b><br>Department:<b> " + dept + "</b><br>Role:<b> " + rl + "</b><br>Type: <b>" + d.Type.value + "</b></font><div id='revEmp' style='display:none'>Testing...</div>");
}
Code:
<select name="Type" id="Type">
<option value="Emp">Employee</option>
<option value="Con">Contractor</option>
</select>
I'm just trying to hide it to begin with, but I get a "'revEmp' is undefined" error. How do I tell it that the ID named 'revEmp' is in the new window?