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

Discussion in 'Javascript' started by Steve, Feb 3, 2006.

  1. Steve

    Steve Guest

    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.
    Steve, Feb 3, 2006
    #1
    1. Advertising

  2. Steve

    Lee Guest

    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;
    Lee, Feb 3, 2006
    #2
    1. Advertising

  3. Steve

    RobG Guest

    Steve wrote:
    > 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>


    [...]


    --
    Rob
    RobG, Feb 3, 2006
    #3
  4. Steve

    Steve Guest

    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.
    Steve, Feb 4, 2006
    #4
  5. Steve

    Steve Guest

    Thank you for your help guys, I got that bit to work.
    Steve, Feb 7, 2006
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. egsdar
    Replies:
    2
    Views:
    2,460
    egsdar
    Nov 18, 2008
  2. ErwinP
    Replies:
    1
    Views:
    727
    ErwinP
    Aug 19, 2005
  3. Jim
    Replies:
    1
    Views:
    848
    Aaron Bertrand - MVP
    Jan 28, 2004
  4. Replies:
    2
    Views:
    210
    J. Gleixner
    Sep 15, 2008
  5. lev
    Replies:
    1
    Views:
    117
    Thomas 'PointedEars' Lahn
    Sep 10, 2008
Loading...

Share This Page