Click to See Complete Forum and Search --> : Getting a text value from another html page
Anjana
04-03-2000, 03:17 PM
Hi,
I've a html page(say,main.htm) which contains a href.
That is,
<a href = " target.htm' target = '_top' >Click me </a>
When I click "Click me", it goes to target.htm. I want to get the value if
a <input> tag (textbox)in the main.htm f4rom target.htm.How can I do this?.
I tried using parent.docuemnt.all.textboxname.innerText.I'm getting an error.Either
I've to pass the textbox value to the target.htm while calling it or I've
to use some other function / syntax to get its value from target.htm.
Any ideas/suggestioons will be greatly helpful for me.Thanks in advance.
anjana
04-03-2000, 06:56 PM
Hi ,
Thanks for your reply. Can you mail me in detail.I tried...Was not able to
get it..
Thanks in advance.
"Dev Ashish" <dev@nomail.please> wrote:
>One way to do this would be to construct pass a normal ASP like query string
>to the HTML document from the Submit event of your form, which you then
>parse out using Javascript. Here's a very basic sample. (Basic because
you
>would probably want to unescape the arguments, split on "=" etc.)
>
>On the first page, test.html, construct an URL as
><A Href="test2.html?FirstValue=Hello&SecondValue=World">Click Here</A>
>
>Then put the following code in within the Body of test2.html.
>
><Script Language="Javascript">
><!--
>var arrArgs = location.search.substring(1).split("&");
>
> for (var i=0; i<arrArgs.length; i++) {
> document.write ('<p>' + arrArgs[i] + "</p>");
> }
>-->
></Script>
>
> -- Dev
>
>"Anjana" <tmmet@hotmail.com> wrote in message
>news:38e8ee59$1@news.devx.com...
>:
>: Hi,
>: I've a html page(say,main.htm) which contains a href.
>: That is,
>: <a href = " target.htm' target = '_top' >Click me </a>
>: When I click "Click me", it goes to target.htm. I want to get the value
if
>: a <input> tag (textbox)in the main.htm f4rom target.htm.How can I do
>this?.
>:
>: I tried using parent.docuemnt.all.textboxname.innerText.I'm getting an
>error.Either
>: I've to pass the textbox value to the target.htm while calling it or I've
>: to use some other function / syntax to get its value from target.htm.
>: Any ideas/suggestioons will be greatly helpful for me.Thanks in advance.
>:
>
>
Vadim
04-04-2000, 02:04 PM
You can try this:
opener.document.form[0].yourfieldname.value
Dev Ashish
04-04-2000, 07:01 PM
One way to do this would be to construct pass a normal ASP like query string
to the HTML document from the Submit event of your form, which you then
parse out using Javascript. Here's a very basic sample. (Basic because you
would probably want to unescape the arguments, split on "=" etc.)
On the first page, test.html, construct an URL as
<A Href="test2.html?FirstValue=Hello&SecondValue=World">Click Here</A>
Then put the following code in within the Body of test2.html.
<Script Language="Javascript">
<!--
var arrArgs = location.search.substring(1).split("&");
for (var i=0; i<arrArgs.length; i++) {
document.write ('<p>' + arrArgs[i] + "</p>");
}
-->
</Script>
-- Dev
"Anjana" <tmmet@hotmail.com> wrote in message
news:38e8ee59$1@news.devx.com...
:
: Hi,
: I've a html page(say,main.htm) which contains a href.
: That is,
: <a href = " target.htm' target = '_top' >Click me </a>
: When I click "Click me", it goes to target.htm. I want to get the value if
: a <input> tag (textbox)in the main.htm f4rom target.htm.How can I do
this?.
:
: I tried using parent.docuemnt.all.textboxname.innerText.I'm getting an
error.Either
: I've to pass the textbox value to the target.htm while calling it or I've
: to use some other function / syntax to get its value from target.htm.
: Any ideas/suggestioons will be greatly helpful for me.Thanks in advance.
:
Dev Ashish
04-04-2000, 08:41 PM
"anjana" <tmmet@hotmail.com> wrote in message
news:38e921a5$1@news.devx.com...
:
: Hi ,
: Thanks for your reply. Can you mail me in detail.I tried...Was not able to
: get it
Well, you could also use the GET method here.
Say you have two files, file1.htm, and file2.htm. Save the following content
as the two files
' ******** File1.htm **********
<HTML>
<HEAD>
</HEAD>
<BODY>
<Form name="frmDefault" action="file2.htm" method="get">
<p>Item1: <Input Type="text" name="txtItem1"></p>
<p>Item2: <Input Type="text" name="txtItem2"></p>
<p><Input type="submit"></p>
</Form>
</BODY>
</HTML>
' ******** File1.htm **********
' ******** File2.htm **********
<HTML>
<BODY>
<Script Language="Javascript">
<!--//
var arrArgs = location.search.substring(1).split("&");
for (var i=0; i<arrArgs.length; i++) {
document.write ('<p>' + arrArgs[i] + "</p>");
}
//-->
</Script>
</BODY>
</HTML>
' ******** File2.htm **********
Now, open up file1.htm in IE, fill in some values, and hit "Submit". You'll
see file2.htm come up with the values you'd typed in file1.
The other alternative would be to use cookies to persist info between two
pages.
-- Dev
devx.com
Copyright Internet.com Inc. All Rights Reserved