-1 |
|
ik wil vanuit een popup items toe kunnen voegen aan een listbox die op de parent pagina staat. de popup wordt dan (logischer wijze) van de parent geopent.
dit is m'n parent code:
<html>
</head>
<body>
<a href="popup.php" target="_blank">open</a><br/>
<form name="testForm">
<select name="listObject" size="3">
</select>
</form>
</body>
</html>
<html> </head> <body> <a href="popup.php" target="_blank">open</a><br/> <form name="testForm"> <select name="listObject" size="3"> </select> </form> </body> </html>
dit is m'n code in popup.php:
<html>
<head>
<script type="text/javascript">
function addOption(selectObject,optionText,optionValue) {
var optionObject = new Option(optionText,optionValue)
var optionRank = selectObject.options.length
selectObject.options[optionRank]=optionObject
}
function removeOption(selectObject,objectRank) {
selectObject.options[objectRank] = null
}
</script>
</head>
<body>
<input type="button" value="Add" onclick="addOption(parent.opener.testForm.listObject,'option','');"/>
</body>
</html>
<html> <head> <script type="text/javascript"> function addOption(selectObject,optionText,optionValue) { var optionObject = new Option(optionText,optionValue) var optionRank = selectObject.options.length selectObject.options[optionRank]=optionObject } function removeOption(selectObject,objectRank) { selectObject.options[objectRank] = null } </script> </head> <body> <input type="button" value="Add" onclick="addOption(parent.opener.testForm.listObject,'option','');"/> </body> </html>
iemand een idee, de oplossing zal wss voor de hand liggen
Greetz
|