Jump to content

[SOLVED] fast question about closing a window


M.O.S. Studios

Recommended Posts

it didn't work

 

this is my code

 

<html>
<head>
<script type="text/javascript">

function sendToPageOne()
{
    var thisValue = document.getElementById('image1').value;
    window.opener.form1.image1.value = thisValue;
}

</script>
</head>
<body>

<form name="form2" onsubmit="window.close()";>
<select name="image1" id="image1">
   <option value="one">One</option>
    <option value="Two">Two</option>
    <option value="Three">Three</option>
</select>
</form>

<input type="submit" onclick="sendToPageOne()"; value="Send to page 1">
</body>
</html>

 

it was opened with this code

 

       <br><a href="javascript:popUp('content/products/browse.php?name=image2')"><font size="1">Browse</font></a><input type="text" name="image2" value="" readonly>

try

<html>
<head>
<script type="text/javascript">

function sendToPageOne()
{
    var thisValue = document.getElementById('image1').value;
    window.opener.form1.image1.value = thisValue;
    close();
}

</script>
</head>
<body>

<select name="image1" id="image1">
   <option value="one">One</option>
   <option value="Two">Two</option>
   <option value="Three">Three</option>
</select>
<input type="button" onclick="sendToPageOne()"; value="Send to page 1">
</body>
</html>

looking at what you did that would probably work aswell,

 

how ever i just did this and it works perfectly

 

<html>
<head>
<script type="text/javascript">

function sendToPageOne()
{
    var thisValue = document.getElementById('<?php echo $_GET['name'] ?>').value;
    window.opener.form1.<?php echo $_GET['name'] ?>.value = thisValue;
}

</script>
</head>
<body>

<form name="form2" action="browse.php" method="POST">
<select name="<?php echo $_GET['name'] ?>" id="<?php echo $_GET['name'] ?>">
   <option value="one">One</option>
    <option value="Two">Two</option>
    <option value="Three">Three</option>
</select>
<input type="hidden" name="sent" value="1">
</form>

<input type="submit" onclick="sendToPageOne();self.close();"; value="Send to page 1">
</body>
</html>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.