Results 1 to 3 of 3

Thread: [RESOLVED] Dead simple javascript question

  1. #1

    Thread Starter
    Hyperactive Member Lil Ms Squirrel's Avatar
    Join Date
    Nov 2004
    Location
    planet squirrel
    Posts
    494

    Resolved [RESOLVED] Dead simple javascript question

    How can I return the value from the javascript prompt method to an asp.net textbox control on my form (much in the same way as the thingy on vbforums that prompts you when you want to insert a hyperlink)?

    TIA

    LMS
    Be who you are and say what you feel, because those who mind don't matter and those who matter don't mind.
    Dr. Seuss

  2. #2
    Frenzied Member dj4uk's Avatar
    Join Date
    Aug 2002
    Location
    Birmingham, UK Lobotomies: 3
    Posts
    1,131

    Re: Dead simple javascript question

    It'll need to be done all client-side. Here is a description of how the prompt function works -> http://www.devguru.com/Technologies/...in_prompt.html.

    You could, rather than loading the returned value into the variable y (as in the linked example), load it directly into your TextBox control.

    Code:
    <script language="JavaScript" type="text/javascript">
    	function loadvalue() {
     		window.document.Form1.TextBox1.value = (prompt("Please enter your name.", "Type name here"))
     	}
    </script>
    Where Form1 is the ID of your form and TextBox1 is the ID of your TextBox control.

    Give me a shout if you have any problems.

    DJ

    If I have been helpful please rate my post. If I haven't tell me!

  3. #3

    Thread Starter
    Hyperactive Member Lil Ms Squirrel's Avatar
    Join Date
    Nov 2004
    Location
    planet squirrel
    Posts
    494

    Re: Dead simple javascript question

    Ta

    The grey matter thought "Oh no, I've gotta do Javascript" and went into suspend mode. It really was that simple
    Be who you are and say what you feel, because those who mind don't matter and those who matter don't mind.
    Dr. Seuss

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width