Results 1 to 5 of 5

Thread: html hyperlink in textbox.

  1. #1
    Join Date
    Jun 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default html hyperlink in textbox.

    hi,
    i want to ask, in html im creating a textbox.
    is it possible i can put links in it and hyperlink it.
    thx a lot.

  2. #2
    Join Date
    Mar 2006
    Location
    Cleveland, Ohio
    Posts
    574
    Thanks
    6
    Thanked 5 Times in 5 Posts

    Default

    no, any code around it would show up as text within the textbox.
    Thou com'st in such a questionable shape
    Hamlet, Act 1, Scene 4

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Hmm... there might be some way to fake this. Why do you need a text box? If you have an area in which users can type, I wouldn't assume you'd want links for them to click on. Especially if it is important, they might just delete the link.

    The two options I can think of--
    1. Create a fake text box, by using a div, etc., that is typable. (I'm not sure if this is actually possible, but it is worth looking into, I think.)
    2. If you are, as I suspect, using the textbox with javascript to output the link (since it's easy to change the value of a textbox based on javascript), you should instead look at a better way to write a link onto the page.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  4. #4
    Join Date
    Jun 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    then how about if i use table?
    is it possible to create scrollbar?

  5. #5
    Join Date
    Mar 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Way to add a hyperlink to a text box

    1 Hour Ago
    I realize this is a very old thread, but I have a VERY easy to implement solution for this requirement.

    Imagine for a moment that you have a text area on a form that someone can enter a URL into... handling the text entry is of course handled for you by the input type="text", but wouldn't it be nice if someone could click on the url in that text box and have the browser take them there.

    The following approach will address that requirement and it has been tested on IE, Safari, Chrome and Firefox and worked on all of them.

    Add the following script to the top of your page.

    <!-- -->
    <!-- Following script used to open a child window -->
    <!-- -->
    <script language="javascript">
    function Reload() {
    window.location.reload();
    }
    function NewWindow(mypage, myname, w, h, scroll, statusbar, tool, menu, location) {
    var winl = (screen.width - w) / 2;
    var wint = (screen.height - h) / 2;
    winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl +',scrollbars='+scroll+', status='+statusbar+',toolbar='+tool+', menubar='+menu+', location='+location+',resizable=no';
    win = window.open(mypage, myname, winprops);
    if (parseInt(navigator.appVersion) >= 4) {
    win.window.focus();
    }
    }
    </script>
    <script language="javascript">
    function Close()
    {
    self.close();
    if (opener && !opener.closed)
    {
    opener.Reload();
    }
    }
    </script>


    Next, modify your input type=text to include invocation of the script.

    For example, this is what the input tag looks like without the hyperlink support.

    <input type="text" name="orgurl" size="30" tabindex="2" value="http://url">
    ... and as you would expect, the text is displayed in this text box as "http://url" but there is no hyperlink capability.

    Now modify the input tag to invoke the script as follows (adding the onClick):

    <input type="text" name="orgurl" size="30" tabindex="2" value="http://url" onClick="javascript:NewWindow('http://url','name','1100','900','yes','yes','yes','yes', 'yes')">

    The text will show as before, and if you click on that textbox, a window opens with the target page in it. To be clear, the cursor doesn't change when you do a mouseover of the text box, but if you click on the text box... off it goes.

    (change the parameters you send to the script as needed of course)

Bookmarks

Posting Permissions

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