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 7 of 7
  1. #1
    New Coder
    Join Date
    May 2004
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Internet Explorer Check if visitor already alerted?

    I want to make a mouseover popup, but i only want it to popup once. How do i do this??

    lol i feel like a stupid newbie

  • #2
    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
    You want that "popup" stays and never disappears unless user press a close button? Or you want it just appears on first onmouseover, dissapears onmouseout and never apeers again (at least not in the same session)?
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    New Coder
    Join Date
    May 2004
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Kor
    You want that "popup" stays and never disappears unless user press a close button? Or you want it just appears on first onmouseover, dissapears onmouseout and never apeers again (at least not in the same session)?
    Sorry, i shoulda been more clear, i wanted an alert, onmouseover="alert("...") and then they click ok and it never appears again in the same session, but does appear in a different session.

    For instance, if they came to my website and put their mouse over the select area, it would popup telling people how to select more than one option using ctrl (for all of the people who dont know anything about computers), and then they click ok and it would dissappear (I know how to do this) , and not popup again unless it was a different session (but i dont know how to do this).


    Do i use cookies?<EEEWWWW i just ate a piece of lent> just make a cookie with no expiry date (is that how you make it delete itself when the browser closes?) and give it like a value of 1 and then do a function called by mouseover:



    <script language="javascript">
    document.cookie="cookiename=1"
    function popup() {
    if (cookiename.value=1) {
    document.cookie="cookiename=0"
    alert("...")
    }
    }
    </script>
    </head>
    <body>
    <select name="select" onmouseover="popup()">



    would that work?
    Last edited by Borommakot; 06-10-2004 at 07:39 PM. Reason: forgot the brackets on the function

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,074
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Why not simply put a small note or tooltip telling how to select multiple items?
    Gecko-based browsers (or probably others as well) support the title attribute for <select> elements but IE unexplicably doesn't support that while it supports that attribute in other tags.

    You can use this code to work with both IE and Gecko-based browsers.

    <select name="select" size="5" style="width:100px" multiple="multiple" title="NOTE: Hold the CTRL or SHIFT to select multiple items">
    <option selected>1</option>
    <option>2</option>
    <option selected>3</option>
    <option>4</option>
    <option selected>5</option>
    <option>6</option>
    </select>
    <!--[if IE]>
    <div style="font:italic 9px Verdana">NOTE: Hold the CTRL or SHIFT key to select multiple items</div>
    <![endif]-->
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #5
    New Coder
    Join Date
    May 2004
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I already tried leaving a note, but itsa form, that is e-mailed to this guy. (im building his website for him ) and he'll not know what it is. an i wanted to keep things simple, so i was hoping to make a popup that would only popup once per session.

  • #6
    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
    Ok, see this example. Not a popup, but a layer is a better choise I presume:

    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">
    <
    style type="text/css">
    <!--
    #pop{
        
    background-color#CCCCCC;
        
    height50px;
        
    width100px;
        
    border1px solid #000000;
    }
    -->
    </
    style>
    <
    script>
    k=0;
    function 
    popOn(){
    if(
    document.getElementById('pop').style.display=='none'){
        if(
    k==0){
        
    document.getElementById('pop').style.display='block';
        
    k++;
        }
    }
    else{
    document.getElementById('pop').style.display='none'}
    }
    </script>
    </head>

    <body>
    <a href="#" onmouseover="popOn()" onmouseout="popOn()">mouseover here</a><br><br>
    <div id="pop"  style="display:none">this will appear only once a session</div>
    </body>
    </html> 
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #7
    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

    and move the display in CSS emebeded up

    I see now that one condition is useless, so I shortened the code like this:

    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">
    <
    style type="text/css">
    <!--
    #pop{
        
    background-color#CCCCCC;
        
    height50px;
        
    width100px;
        
    border1px solid #000000;
        
    display:none;
    }
    -->
    </
    style>
    <
    script>
    k=0;
    function 
    popOn(){
    if(
    k==0){
    document.getElementById('pop').style.display='block';
    k++;
    }
    else{
    document.getElementById('pop').style.display='none'}
    }
    </script>
    </head>

    <body>
    <a href="#" onmouseover="popOn()" onmouseout="popOn()">mouseover here</a><br><br>
    <div id="pop">this will appear only once a session</div>
    </body>
    </html> 
    Last edited by Kor; 06-12-2004 at 07:55 AM. Reason: Style movement
    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
    •