• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 157
  • Last Modified:

Pls Help

i have a textfield and button on A.html
i wish to send the value in the textfield to a textfield on B.html upon click on the button on A.html.
(e.g.input "abc" into the textfield on A.html,when click on the button,popup a new browser window which opens B.html,and displays "abc" on the textfield on B.html)
can someone show me how to do that?
1 Solution
Can you use CGI/ASP if not then your only solution will be with Javascript.

HTML don't accept inputs. You have to use some sort of PROCESSING, which means Javascript, or CGI and its relatives (ASP, CFML, PHP, etc.)
If you use javascript, cookies would probably be the easiest. Just set the cookie when the button is clicked on and retrive it when the next page loads.
Something like this:

in a.html:

<form method="get" name="form1">
<input type="text" name="textfield1">
<input type="button" name="button1" value="Open B"           onClick="open_b_func(this.form)">

<script language="JavaScript">
function open_b_func(theform) {
   tf1 = theform.textfield1;

   mynewwindow = window.open("B.html","mynewwindow","");
   // Provided that the first form in b.html has a field called textfield1.
   mynewwindow.document.forms[0].textfield1.value = tf1.value;
   // alternatively, you could construct the html for the new window here,
   // and write it out using:
   // mynewwindow.document.open("text/html");
   // mynewwindow.document.write("<html><head></head><body><form><input    // type=\"text\" value=\" + tf1.value + "\"></form></body></html>");
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now