Hello, just a quick Q for someone more experienced.
I am trying to open a new browser window (in this example a pdf) from a an item selected in a form (combobox/dropdown list).
Just include a pdf called test.pdf in the same directory. It works outside of the form but now when called from within. Please help!
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Test</title>
<script language="JavaScript">
function selectIndex(selObj) {
ref = selObj.options[selObj.selectedIndex].value;
openWindow(ref);
}
function openWindow(ref) {
alert(ref); <!-- works ok to here -->
newWin = window.open(ref, "Test", " statusbar,menubar,toolbar,dependant,resizable,scro
llbars,titlebar");
}
</script>
</head>
<body>
<form name="formIndex" id="formIndex">
<select name="menu" onChange="selectIndex(this)">
<option value="" id="">click below</option>
<option value="test.pdf" id="test">Test</option>
</select>
</form>
<p>But here it works - <a href="javascriptpenWindow('test.pdf')">Test</a></p>
</body>
</html>
I am trying to open a new browser window (in this example a pdf) from a an item selected in a form (combobox/dropdown list).
Just include a pdf called test.pdf in the same directory. It works outside of the form but now when called from within. Please help!
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Test</title>
<script language="JavaScript">
function selectIndex(selObj) {
ref = selObj.options[selObj.selectedIndex].value;
openWindow(ref);
}
function openWindow(ref) {
alert(ref); <!-- works ok to here -->
newWin = window.open(ref, "Test", " statusbar,menubar,toolbar,dependant,resizable,scro
llbars,titlebar");
}
</script>
</head>
<body>
<form name="formIndex" id="formIndex">
<select name="menu" onChange="selectIndex(this)">
<option value="" id="">click below</option>
<option value="test.pdf" id="test">Test</option>
</select>
</form>
<p>But here it works - <a href="javascriptpenWindow('test.pdf')">Test</a></p>
</body>
</html>