...

View Full Version : Check if visitor already alerted?



Borommakot
06-10-2004, 05:01 AM
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 :D

Kor
06-10-2004, 07:53 AM
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)?

Borommakot
06-10-2004, 07:09 PM
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?

glenngv
06-11-2004, 06:23 AM
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]-->

Borommakot
06-11-2004, 04:34 PM
I already tried leaving a note, but itsa form, that is e-mailed to this guy. (im building his website for him :D ) 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.

Kor
06-12-2004, 07:42 AM
Ok, see this example. Not a popup, but a layer is a better choise I presume:



<!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;
height: 50px;
width: 100px;
border: 1px 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
06-12-2004, 07:52 AM
I see now that one condition is useless, so I shortened the code like this:



<!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;
height: 50px;
width: 100px;
border: 1px 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>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum