SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Addict djh's Avatar
    Join Date
    Apr 2000
    Location
    Long Beach, CA
    Posts
    333
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Double click an item in a Multi-Line Text Field

    Hey all -

    Anyone know whether it's possible to allow users to double click items of a multi-line text field? Of course, I want the double click to take them to another URL...

    If you know this, you are a god...

  2. #2
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It might be possible in IE 4+ using the TextRange object that IE supports, but I don't think it can be done in NS/Moz or Opera.
    MarcusJT
    - former ASP web developer / former SPF "ASP Guru"
    - *very* old blog with some useful ASP code

    - Please think, Google, and search these forums before posting!

  3. #3
    Rehab is for quiters! spartan's Avatar
    Join Date
    Apr 2002
    Location
    Cape Town, South Africa
    Posts
    343
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    do you mean... you want users to be able to dbl click on a word in a text field?
    Spartan
    ---------------------
    It's like our sergeant told us before one trip into the jungle. Men! Fifty of you are leaving on a mission. Twenty-five of you ain't coming back.
    -Mr.Payne

  4. #4
    Rehab is for quiters! spartan's Avatar
    Join Date
    Apr 2002
    Location
    Cape Town, South Africa
    Posts
    343
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try this, dunno if its exactly what you're looking for, but maybe it helps...

    Code:
    <HTML>
    <HEAD>
    <TITLE>testng</TITLE>
    <script language=javascript>
    function checksel()
    {
    var slen;
    var selx = false;
    var i;
    var id;
    slen=this.subdname.length;
    for (i=0; i < slen; i++)
    	{if (this.subdname.options[i].selected)
    		{selx = true;}}
    if (selx == true){
    	id = ( this.subdname.options[this.subdname.selectedIndex].value);
    	alert("you selected number " + id)
    	}else{alert ('Nothing selected. Please select something to proceed')}
    }
    
    
    </script>
    </HEAD>
    <BODY>
    
    <select name="subdname" size="12" onDblClick = "checksel()">
    <option value="1">option1</option>
    <option value="2">option2</option>
    <option value="3">option3</option>
    <option value="4">option4</option>
    <option value="5">option5</option>
    <option value="6">option6</option>
    <option value="7">option7</option>
    </select>
    
    </BODY>
    </HTML>
    Spartan
    ---------------------
    It's like our sergeant told us before one trip into the jungle. Men! Fifty of you are leaving on a mission. Twenty-five of you ain't coming back.
    -Mr.Payne

  5. #5
    Rehab is for quiters! spartan's Avatar
    Join Date
    Apr 2002
    Location
    Cape Town, South Africa
    Posts
    343
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    my apologies for the overkill on the code there. just cut it from a old function I had. all of that is not needed.

    for what I was trying to illistrate you only really need this...
    Code:
    <HTML>
    <HEAD>
    <TITLE>testng</TITLE>
    <script language=javascript>
    function checksel(that)
    {
    alert(that.value)
    }
    
    
    </script>
    </HEAD>
    <BODY>
    
    <select name="subdname" size="12" onDblClick = "checksel(this)">
    <option value="1">option1</option>
    <option value="2">option2</option>
    <option value="3">option3</option>
    <option value="4">option4</option>
    <option value="5">option5</option>
    <option value="6">option6</option>
    <option value="7">option7</option>
    </select>
    
    </BODY>
    </HTML>
    Spartan
    ---------------------
    It's like our sergeant told us before one trip into the jungle. Men! Fifty of you are leaving on a mission. Twenty-five of you ain't coming back.
    -Mr.Payne

  6. #6
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    True - although djh did say "multi-line text field" (i.e. a TEXTAREA element), it is entirely possible that he actually meant a SELECT element (with/without the MULTIPLE attribute set)...!

    djh? Have Spartan or myself solved your problem, or are we both barking up the wrong tree altogether?
    MarcusJT
    - former ASP web developer / former SPF "ASP Guru"
    - *very* old blog with some useful ASP code

    - Please think, Google, and search these forums before posting!

  7. #7
    Rehab is for quiters! spartan's Avatar
    Join Date
    Apr 2002
    Location
    Cape Town, South Africa
    Posts
    343
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    woof woof!


    Marco... if he did want toe use a textarea... would it be possible to get same kinda effect as I managed with the select? lets say I want to double click on a word in he text area and then have a apropriate message pop-up...

    is that at all posible?
    Spartan
    ---------------------
    It's like our sergeant told us before one trip into the jungle. Men! Fifty of you are leaving on a mission. Twenty-five of you ain't coming back.
    -Mr.Payne

  8. #8
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's exactly what I took his original question to mean, and so the answer (AFAIK) is what I posted!!!
    MarcusJT
    - former ASP web developer / former SPF "ASP Guru"
    - *very* old blog with some useful ASP code

    - Please think, Google, and search these forums before posting!

  9. #9
    Rehab is for quiters! spartan's Avatar
    Join Date
    Apr 2002
    Location
    Cape Town, South Africa
    Posts
    343
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    *feeling stupid*
    ok... what does AFAIK stand for
    Spartan
    ---------------------
    It's like our sergeant told us before one trip into the jungle. Men! Fifty of you are leaving on a mission. Twenty-five of you ain't coming back.
    -Mr.Payne

  10. #10
    SitePoint Zealot Paul_M's Avatar
    Join Date
    Mar 2001
    Location
    London
    Posts
    160
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Wink

    AFAIK = As Far As I Know....
    AFAIK :-)

  11. #11
    Rehab is for quiters! spartan's Avatar
    Join Date
    Apr 2002
    Location
    Cape Town, South Africa
    Posts
    343
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Spartan
    ---------------------
    It's like our sergeant told us before one trip into the jungle. Men! Fifty of you are leaving on a mission. Twenty-five of you ain't coming back.
    -Mr.Payne


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
  •