Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
What is wrong with this script. It did not pass the value to input. Basically, what i am trying to do is this:
In index page, there is a link(link#1) and an input. And, when I click link#1, there will be a pop up window which contain link#2. And when I click link#2, it will pass a value to input in index page, and the popup will close. Here's the script.
*For index.html;
<html>
<head>
<script type="text/javascript">
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=400px,height=500px,left = 312,top = -16');");
}
</script>
</head>
<body>
<form name="formname">
<input id="font_type" type="text" name="font_type">
[a href="javascript:void()" onclick="javascript:popUp('pop.html')"]Font[/a] <-- I have to use [a] to avoid the forum to post it as a link.
</form>
</body>
</html>*For pop.html:
<html>
<head>
<title></title>
<script type="text/javascript">
function font() {
document.formname.font_type.value = "Arial";
}
</script>
</head>
<body>
[a href="javascript:void()" onclick="font();window.close();"]
Arial
[/a]
</body>
</html>

I found the solution. Changes to be made is in pop.html;
[a href="javascript:opener.document.formname.font_type.value='Arial';self.close();"]
Arial
[/a] <--Assuming [a] is <a> to avoid this message board to post it as a link.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |