I have this code (which I did not make) which basically makes a container with an X, so when I press the X, the div container closes. However, when you refresh the page, the div container will reappear again. How can I make it so when the person presses the X button, the person will never see the div container ever again (or for a set amount of time like 30 days) on that page?
I want to take it one step further, if possible, and make it so when the person presses the X button, he/she will never see the div container again throughout my site, as I plan on implementing the same div container throughout my site.
HTML Code: <div id="bottom_ad"> <div id="close_ad" onclick="close_bottom_ad();">X</div> <!-- Ad Content --> [Code]......
function setCookie(c_name,value,expiredays){ var exdate=new Date(); exdate.setDate(exdate.getDate()+expiredays); document.cookie=c_name+ "=" +escape(value)+ ((expiredays==null) ? "" : ";expires="+exdate.toGMTString()); } Above is the code I'm using. I just copy/pasted it from another website, so I don't know how to change it. I want the expiration to be about 10 minutes. I tried decimals (0.007 day), but it doesn't work.
which lasts for 1 day, but I would like the cookie to not expire for a long time, is this possible? I know google has one that like expires in 2035 or something but I would like this on to last long. What should I do?
I have a page which I have protected using a password page. When the person viewing the site clicks on the link to the protected page, I have placed a script on onload that checks whether a cookie exists. If the cookie doesn't exist then the person is redirected to the password page. If they enter the correct password then the cookie is created using the following code and they are allowed to enter the protected page:
document.cookie="true";
If the cookie exists however, then they are allowed straight into the protected page. This is the code that I use to check whether or not the cookie exists: Code:
I'm searching for a pre-made cookie script or a tutorial on making a simple session cookie. Just a cookie to make sure users are getting most current copies of HTML pages on my site.
Up till now I've just had messages on each page instructing them to refresh to make sure the have the latest version.
MY PROBLEM: OK, if you load this up into your browser, you can see I have two lines of text that show/hide themselves by clicking on the other line. I know how to set the cookie name and the two different values ("show_hide_cookie=line1", "show_hide_cookie=line2") and I can see that they are there when I view my browser's cookies. But I've spent hours trying to figure out the javascript code to get it to read the cookie and remember the preferences. Right now of course, if you click on the first line and then refresh your browser, it resets the second line back to the first line.
It's supposed to set the expiration date of all the cookies on my page for one year, but it's not working. I know it's not working because Safari lets you see the expiration date for each cookie set on a page, and it didn't show it for the elements being set on my page.
I'm using jQuery for this, so heres my one script: var currentRotation=null; function checkOrientAndLocation(){ if(currentRotation != window.orientation){ setOrientation(); }} function setOrientation(){ switch(window.orientation){ case 0: orient = 'portrait'; break; case 90: orient = 'landscape'; break; case -90: orient = 'landscape'; break; } currentRotation = window.orientation; document.body.setAttribute("orient",orient); setTimeout(scrollTo,0,0,1); }
$(window).unload(function() { // On page unload $('.remember').each(function() { // Save each value to expire in a year $.cookie(this.id, this.value, {expires: 365}); }); $('.draggable').each(function() { // Save draggable positions var draggable = $(this); $.cookie(this.id, draggable.css('top') + '_' + draggable.css('left'), {expires: 365}); $.cookie('disp' + this.id, draggable.css('display'), {expires: 365}); });});
$(function() { var val, pos, disp; setInterval(checkOrientAndLocation,1000); $('.remember').each(function() { var val = $.cookie(this.id); // Retrieve value for this element if (val) { this.value = val; }}); $('.draggable').each(function() { var pos = $.cookie(this.id); // Retrieve values for this element if (pos) { pos = pos.split('_'); $(this).css({position: 'absolute', top: pos[0], left: pos[1]}); } var disp = $.cookie('disp' + this.id); if (disp) { this.style.display = disp; }}).touch({animate: false, sticky: false, dragx: true, dragy: true, rotate: false, resort: false, scale: false });});
There's also a file that sets the basic elements for the cookie, but the expiration date code should be in the file above.
I need some quick help with one of my scripts. It's supposed to set the expiration date of all the cookies on my page for one year, but it's not working. I know it's not working because Safari lets you see the expiration date for each cookie set on a page, and it didn't show it for the elements being set on my page.
I'm using jQuery for this, so heres my one script:
[Code]...
There's also a file that sets the basic elements for the cookie, but the expiration date code should be in the file above.
I'm trying to create a simple checkout system that utilizes cookies to pass information from page to page. Currently, my entire script works fine except for the read cookie portion. I cannot figure out what is wrong with it. It has been validated and the syntax is fine; it just doesn't work. I use the function with the onload call on my html file such as:
I am developing a web site for a summer comedy series. The site has links to buy tickets but I want them to disappear two hours before the show begins. Does anyone know how to use a simple javascript that shows and hides text and links after a date has passed?
I wrote a pair of functions to enable scoped or referenced setTimeout calls. I did this because I have an object factory that creates multiple objects and those objects need to delay a few calls on themselves at a certain point in time.
This code works fine for normal objects. However, my issue occurs if at any point, an event object is passed across in IE.
It seems, that events methods and variables in IE are PRIVATE (!) after the initial callstack has been finished.
The following is the code required to view this bug(?) in IE, and success in FF. Code:
I have a start date and end date text boxs. What I would like to achieve is when a submit button is clicked all the available dates between start and end dates should be displayed together with 3 check boxes next to each date (please see below). I am just wondering whether that'sachievablewith jquery, and if so, how I might be able to implement this.
Can I make a list of hyperlinks that users can customize and save as a cookie by clicking a button and automatically retrieve the cookie so it remembers their list next time? This is kind of what I want to do:
I am making a sort of text based game (Just a hobby) I like to do that sort of thing. So, anyway, considering all I can really do is code HTML, and very, very light javascript, I kinda need some help.
I basicly know how to do everything except affect & Use the cookies. So what I need to do with them is to
#1.) Have a code to change the cookie number, say... on the click of a button.
#2.) Have a code where it only displays certain text if the cookie is a certain number.
I cant code JS and have no idea how hard/easy this is.
If it is insanely hard & needs a master coder, just tell me and ill take it off. I dont want to be wasting anyones time.
I have an embedded system with a web interface. One of the web pages has a small JavaScript program that, when run on IE6, always displays the message that cookies need to be enabled:
if (document.cookie.indexOf('asm_session') == -1) { document.cookie = 'asm_session=0' if (document.cookie.indexOf('asm_session') == -1) { document.write("Advanced System Management access requires cookies to be enabled."+'<br><br>'); } }
This problem only occurs with IE6, not Mozilla. It also only happens on some of the embedded systems, but this problem exists for everyone running IE6.
The problem isn't limited to the Javascript code, either. On another web page from this embedded system, a cookie is set the normal way, via the HTTP header. This cookie is also rejected.
When I display any page that attempts to set a cookie, IE6 displays the blocked icon and says that cookies on that URL are blocked. However, I have set all privacy and cookie options to their most permissive. I've spent the past hour changing every option I can find that's even remotely related to cookies and privacy, and nothing changes. Does anyone have any idea what's going on?
In my web application we are able to store large data in the browser cookie keeping in mind the limit of 300 cookies per cookie file, 20 keys per cookie per domain and 4KB max size of each cookie. We are unable to retreive this large amount of data immediately after storing through document.cookie in IE browser (The same works fine in Netscape).
Is there any limit on the size of the data that can be retreived using document.cookie in IE browser? Could you please suggest a solution to this problem I am facing.
I have added a booking form to a website with belongs to fastbooking.You can see a temporary website here. http:[url]....It works perfectly fine in Mozilla Firefox, Google Chrome, Opera and Safari but it does not load on Internet Explorer.On the other browsers the form loads todays date and the year is generated but on IE the date stays on 01-01 and no year is generated.I'm using wordpress as a cms.I think the code that is not loading is <body onLoad='start();'>But I'm not sure. The code of the year is
<select name='fromyear' class="input" onChange='update_departure();'> <option value="0"></option> </select> But since it's no just the year I assume its the onload code.
I tried to add the onload to the header function like this
I am trying to use the jquey datepicker. I want to show the date chosen by the user in a <span> element with a particular format. However my code maintains the default format. What am I doing wrong?
We have a little callendar on our website. I have set the format of the date to "dd-mm-y" because I want the date to be saved europian, not american. When comfirming the form, the date is saved as 0000-00-00. The date shows correctly on the form itself. I have two scripts: Calendar.js and Calendar-en-GB.js. Calendar-en-GB.js contains the 'settings'. (Including date format). I can't figure out the problem and thought maybe one of you could. I have uploaded the scripts in one .zip file: [URL]
I have a problem setting the default date of my jquery datepicker to the date that I retrieved from my database. I'm currently using the jquery datepicker linked to selects/ drop downs. I auto-fill my selects (month, day, year) from an external javascript. (fbDateTime.js)
I want to display the alert when user enters the time less than the system time and date should be current date and if the date is greater than current date it should ignore the alert box. Here is the code
<script type="text/javascript"> function check() { var now = new Date(), timeParts = document.contact_form.time.value.split(':'),
Can anybody give me complete code and steps wherein i can implement the dtpicker in only "yyyy-mm-dd" format. i want the user to select the date using this dtpicker and the selected date should show in the textbox on the form.