Computing.Net > Forums > Web Development > Javascript: Cross input via link

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Javascript: Cross input via link

Reply to Message Icon

Name: mie2com
Date: December 2, 2006 at 23:28:04 Pacific
OS: WinXP
CPU/Ram: Pentium III
Product: Sony
Comment:

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>




Sponsored Link
Ads by Google

Response Number 1
Name: mie2com
Date: December 3, 2006 at 06:02:55 Pacific
Reply:

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.


0
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: Javascript: Cross input via link

Javascript data for a link www.computing.net/answers/webdevel/javascript-data-for-a-link/525.html

Link Parser www.computing.net/answers/webdevel/link-parser/3667.html

Email Entire Page Link www.computing.net/answers/webdevel/email-entire-page-link/887.html