how to transfer textbox value from .net page to html page textbox?

S

Steve

My question is both .net and javascript and I thought it would be best
posted here.

I have a pop up html page (it just has to be html) with a textbox and a
button next to it. When the user clicks on the button an asp.net page
pops up which allows the user to upload a photo. The asp.net code then
puts the url of this photo into a textbox in the asp.net page. I now
want to be able to press a button and have the value from the asp.net
textbox transferred to the html textbox. Can you please show me how
with example code? I assume the code has to be in javascript?

I hope that's clear. I know you may be thinking why don't I do the
whole thing in .net but the html page has just loads of other things
and javascript on it and I can't really change it.

Thank you.
 
L

Lee

Steve said:
My question is both .net and javascript and I thought it would be best
posted here.

I have a pop up html page (it just has to be html) with a textbox and a
button next to it. When the user clicks on the button an asp.net page
pops up which allows the user to upload a photo. The asp.net code then
puts the url of this photo into a textbox in the asp.net page. I now
want to be able to press a button and have the value from the asp.net
textbox transferred to the html textbox. Can you please show me how
with example code? I assume the code has to be in javascript?

I hope that's clear. I know you may be thinking why don't I do the
whole thing in .net but the html page has just loads of other things
and javascript on it and I can't really change it.

Whether a page is static HTML or generated by ASP doesn't matter
at all in this context. After filtering out a lot of references
to "asp.net page", I think what's left is that you have a parent
page with a textbox, and you want a child page to be able to
write into that textbox.

In the child page:

opener.document.forms[0].elements["NameofTextBox"].value=whatever;
 
R

RobG

Steve said:
My question is both .net and javascript and I thought it would be best
posted here.

I have a pop up html page (it just has to be html) with a textbox and a
button next to it. When the user clicks on the button an asp.net page

Once it leaves the server, it is HTML. ASP .NET is irrelevant after that.

pops up which allows the user to upload a photo. The asp.net code then
puts the url of this photo into a textbox in the asp.net page. I now
want to be able to press a button and have the value from the asp.net
textbox transferred to the html textbox. Can you please show me how

ASP is on the server, I guess you mean in the browser page.
with example code? I assume the code has to be in javascript?

<script type="text/javascript">

function writeText(id, txt)
{
var s;
if ( document.createTextNode
&& document.getElementById
&& (s = document.getElementById(id)) ){
while (s.firstChild) s.removeChild(s.firstChild);
s.appendChild(document.createTextNode(txt));
}
}

</script>

<form action="">
<input type="file" id="fileName">
<input type="button" value="Show file path"
onclick="writeText('thePath', this.form.fileName.value);">
</form>
<div>Here is the filename and path: <span id="thePath"></span></div>


[...]
 
S

Steve

Thank you for the replies Rob and Lee. I will try out the suggestions.
Thank you for taking the time to point me in the right direction.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top