I am volunteering at a hospital and working on the intranet. They want an option to have a pop up message but they only want it to pop up once or twice, and then be able to change the content and have it re pop-up.
Example: week1 how to properly wash your hands
Week2: system wide meeting on thursday dont forget. etc etc..
I am not very good in Java. but this is what i have so far. Can anyone point me in the right direction. Greatly appreciated.
also we use active directory, so i dont know if we could maybe pull by user name? Thanks -
var username = GetCookie('username');
-
-
if (username == null) {
-
username = prompt('Please enter your name (otherwise press cancel)',"WebSurfer");
-
if (username == null) {
-
alert('Its ok if you dont want to tell me your name');
-
username = 'WebSurfer';
-
} else {
-
pathname = location.pathname;
-
myDomain = pathname.substring(0,pathname.lastIndexOf('/')) +'/';
-
var largeExpDate = new Date ();
-
largeExpDate.setTime(largeExpDate.getTime() + (365 * 24 * 3600 * 1000));
-
SetCookie('username',username,largeExpDate,myDomain);
-
}
-
}
-
-
function getCookieVal (offset) {
-
var endstr = document.cookie.indexOf (";", offset);
-
if (endstr == -1)
-
endstr = document.cookie.length;
-
return unescape(document.cookie.substring(offset, endstr));
-
}
-
-
function GetCookie (name) {
-
var arg = name + "=";
-
var alen = arg.length;
-
var clen = document.cookie.length;
-
var i = 0;
-
while (i < clen) {
-
var j = i + alen;
-
if (document.cookie.substring(i, j) == arg)
-
return getCookieVal (j);
-
i = document.cookie.indexOf(" ", i) + 1;
-
if (i == 0)
-
break;
-
}
-
return null;
-
}
-
-
function SetCookie (name, value) {
-
var argv = SetCookie.arguments;
-
var argc = SetCookie.arguments.length;
-
var expires = (argc > 2) ? argv[2] : null;
-
var path = (argc > 3) ? argv[3] : null;
-
var domain = (argc > 4) ? argv[4] : null;
-
var secure = (argc > 5) ? argv[5] : false;
-
document.cookie = name + "=" + escape (value) +
-
((expires == null) ? "" : ("; expires=" +
-
expires.toGMTString())) +
-
((path == null) ? "" : ("; path=" + path)) +
-
((domain == null) ? "" : ("; domain=" + domain)) +
-
((secure == true) ? "; secure" : "");
-
}
1 1215 acoder 16,027
Recognized Expert Moderator MVP
Cookies would only work for one particular computer/browser. If you need this over a number of computers/users, use server-side code.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Keith Patrick |
last post by:
I'm trying to programmatically post data to another page within my ASP.Net
app. Not POSTing is not an option (I can't store this data in my session,
context, hidden fields, or anything else...I've exhausted all my other
options, so I have to get this scenario working). Basically, if I POST the
data normally, it works fine, except the target page has a new session ID,
so I lost the session data that I *do* transfer around. However, if I...
|
by: evanburen |
last post by:
When my page loads, I check for the existence of a cookie value through
readCookie(). If there is a value present for the cookie, I would like
that to be the default value in function ordering() and that value to
be the SELECTED value in ddlProfileNames. In other words, if there is
no cookie value, then function ordering will default to
ordering("Div1,Div2,Div3,Div4"). If there is a value, then that should
be used in function ordering...
|
by: joseph conrad |
last post by:
Hi,
I tried to implement my own session handler in order to keep control on
the process
the drawback I foun it is not creating and storing in my cookie the
PHPSESSID variable anymore.
reading te documentation it seems it should do it anyway
any advice?
|
by: Griff |
last post by:
Hi
I have an HTML search page that contains a drop-down box with
approximately 78,000 items in it.
The actual content of this select box varies depending upon some of the
parameters a user has chosen, so this needs to be loaded (possibly
several times as they change their parameters) and I've got this
working using AJAX.
|
by: toxicpaint |
last post by:
Hi there,
I've built a form for peolpe to submit a vote and I thought the best way to restrict people voting twice would be to create a cookie called "voted" and set the value to 1 when they vote.
When the page loads I want it to check for the cookie to see if that person has voted or not.
The script is creating a cookie called "vote" and setting it to 1.
I've attempted to write an if statement that checks this, but I can't get it...
| |
by: marc heiners |
last post by:
Hello!
I have to overgive an information from one website to another (same domain)
by sertting a cookie with javascript.
When the website is requested by a user a session cookie with a default
value (for example 'miller') should be set with javascript or php. If the
user chose a drop down menue on the website the cookie´s value should be
overwritten with the chosen value from the drop down menu.
<select name="familynames">
|
by: Mike Copeland |
last post by:
In a Web site I'm building, I want to provide an ability to set a
"flag" message that users can see when they log on. Specifically, I
want the "flag" to show when the (snail) mail for our building has been
delivered, so people can come to the mailboxes to pick up their incoming
mail.
The problem is that I want to have a staff person "set the flag" in
some way. This person won't be technically savvy, nor would I want to
give them...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |