Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Sep 2004
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    is there any way to mimic the "alt" or "title" behaviors on option?

    Hello
    is there any way to mimic the way "alt" or "title" properties works on html objects
    but on select box options , that is when i select option there will be title with the option text in it.
    thanks

  • #2
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    Actually try it. Gecko-based browsers have no problem with it. I know IE can't do it, but I am unsure with Opera and KHTML...

  • #3
    New to the CF scene
    Join Date
    Sep 2004
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    well what can i do but our application is only working with IE.
    i need to find some alternative way ..
    there must be something out there...

  • #4
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Hm. Unfortunately it looks like IE doesn't accept any event (onfocus or onmouseover) inside <option> tag, so I am affraid the only crossbrowser solution could be using onchange event...
    PHP Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <
    html>
    <
    head>
    <
    title>Untitled Document</title>
    <
    meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <
    meta http-equiv="Content-Style-Type" content="text/css">
    <
    meta http-equiv="Content-Script-Type" content="text/javascript">
    <
    style type="text/css">
    <!--
    #txt{
        
    font-familyArialHelveticasans-serif;
        
    font-size10px;
        
    color#000000;
        
    background-color#FFFFCC;
        
    displaynone;
        
    padding2px;
        
    border1px solid #0000CC;
        
    positionabsolute;
        
    z-index10;

    }
    -->
    </
    style>
    <
    script language="JavaScript" type="text/JavaScript">
    function 
    showT(s,t){
    if(
    s.offsetParent){
    pLeft=s.offsetParent.offsetLeft;
    pTop=s.offsetParent.offsetTop
    }else{pLeft=0;pTop=0}
    var 
    x=s.offsetLeft+s.offsetWidth+pLeft;
    var 
    y=s.offsetTop+pTop;
    var 
    a=document.getElementById('txt');
    a.innerHTML='';
    a.style.display='none';
        if(
    s.selectedIndex>0){
        
    a.appendChild(document.createTextNode(t));
        
    a.style.left=x;
        
    a.style.top=y
        a
    .style.display='block';
        }
    }
    </script>
    </head>
    <body leftmargin="0" topmargin="0">
    <select onchange="showT(this,this.options[this.selectedIndex].text)">
      <option selected>Select item</option>
      <option>Item 1</option>
      <option>Item 2</option>
      <option>Item 3</option>
    </select>
    <div id="txt"></div>
    </body>
    </html> 
    Last edited by Kor; 10-22-2004 at 10:29 AM.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

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