I am using a script (see below) to check if cookies are enabled on my
website. The script seems to work but I get an Object Expected error.
The error repor says it is at the line incidated by the *** below. Any
ideas?
<script type="text/javascript">
Set_Cookie( 'test', 'none', '', '/', '', '' );
if ( Get_Cookie( 'test' ) )
{
***
cookie_set = true;
Delete_Cookie(' test', '/', '');
}
else
{
document.write( '<p><strong>In order to log in, your browser must
accept cookies. At the moment, your browser is set not to accept
cookies so you will not be able to log in.</strong><p>' );
cookie_set = false;
}
function Set_Cookie( name, value, expires, path, domain, secure )
{
// set time, it's in milliseconds
var today = new Date();
today.setTime( today.getTime() );
/*
if the expires variable is set, make the correct
expires time, the current script below will set
it for x number of days, to make it for hours,
delete * 24, for minutes, delete * 60 * 24
*/
if ( expires )
{
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date( today.getTime() + (expires) );
document.cookie = name + "=" +escape( value ) +
( ( expires ) ? ";expires=" + expires_date.to GMTString() : "" ) +
( ( path ) ? ";path=" + path : "" ) +
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}
function Get_Cookie( name ) {
var start = document.cookie .indexOf( name + "=" );
var len = start + name.length + 1;
if ( ( !start ) &&
( name != document.cookie .substring( 0, name.length ) ) )
{
return null;
}
if ( start == -1 ) return null;
var end = document.cookie .indexOf( ";", len );
if ( end == -1 ) end = document.cookie .length;
return unescape( document.cookie .substring( len, end ) );
}
</script> 1 2274
JRS: In article <11************ **********@g14g 2000cwa.googleg roups.com>
, dated Thu, 12 Jan 2006 07:07:23 local, seen in
news:comp.lang. javascript, St***********@g mail.com posted : // set time, it's in milliseconds var today = new Date(); today.setTim e( today.getTime() );
One wonders what that line is intended for.
/* if the expires variable is set, make the correct expires time, the current script below will set it for x number of days, to make it for hours, delete * 24, for minutes, delete * 60 * 24 */ if ( expires ) { expires = expires * 1000 * 60 * 60 * 24;
If you want to change by a certain number of days, use getDate and
setDate. If you want to change by a certain number of hours, use
getHours and setHours. That avoids apparent or real error at Summer
Time changes.
var expires_date = new Date( today.getTime() + (expires) );
That will give an apparent error across changes in Summer Time state.
You probably don't need a second Date Object -
D.setTime(D.get Time()+864e5)
or D.setTime(+D +864e5)
though those retain the apparent error.
--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 MIME. ©
Web <URL:http://www.merlyn.demo n.co.uk/> - w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demo n.co.uk/programs/> - see 00index.htm
Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm etc. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Wayno |
last post by:
My php logs are coming up empty. I have done all I can think of, and
all that made sense to me. Can someone take a look at my php.ini
please and tell me what you think may be the problem.
I double-checked the path to my error log. It is in
/var/www/logs/php_error_log
Thanks. :)
-Wayne Stevenson
|
by: Shannon Jacobs |
last post by:
I'm doing some trivial surveys, and I want to know if the same user
answers twice. Can't really know that, but at least I thought I could
check for the same browser/computer combination by using a cookie.
Here is the code I have now. In the header, I have the following:
<SCRIPT language="JavaScript">
var cookieStatus;
if (document.cookie.length > 0) {
cookieStatus = 'Cookie exists with value ' + document.cookie;
} else {
|
by: Chris |
last post by:
I've read through the prevoius posts and coudln't find an answer. I'm getting a "Object reference not set to an instance of an object." and can't figure out why. My pageload sub is check for login = true, then cookie to login, then bounce to login page. So I find if the user isn't logged in and there is no cookie I get this error. I have no drop-downs within the "If Not IsPostBack Then". I have dataasbe calls (datareader) to populate the server...
|
by: Kiyomi |
last post by:
Hello,
I am trying to replace my alert message box with a popup page.
In my page behind,
|
by: eruanion |
last post by:
Hi, I've been working on this for a while now and I can't seem to find
out what is wrong with my code. I have 2 files one c3common.js which
only contains javascript functions for my main html page and my main
html page which is test.html. They are of course part of a much bigger
system of files but i have tracked down the problem to that reduced
part of the code. The page loads perfectly fine however when i click
search i get the error...
| |
by: Greg |
last post by:
I'm guessing the problem I'm having has something to do with Master Pages or
DetailsView because the exact same code works fine on a page without a Master
Page and DetailsView controls.
The problem is, when the javascript fires on the txtDateRequiredOut TextBox
in IE, I get "Error on Page" in the status bar and the error says: "Object
Expected". Viewing the source of the page while running shows a link created
properly for the linked...
|
by: Dagwood Bumstead |
last post by:
I play around with js a little... I just don't get this.
The file below is just trying out some things... it does exactly what
I want (hides/displays some things, no big deal)
The problem is that in the swapcheck(x) function below, if I uncomment
the first line (commented with //) the whole thing brings and IE
errors the page with an object expected error on line (whichever input
control I clicked).
|
by: geevaa |
last post by:
Hi Group,
The page 167 of book Learning PHP5 by David Sklar says that
setcookie() and session_start() must be added before any output.
I tried to use that functions at last line but no warning!.
The warning which i got 1 month back is not issued now.
------------------------------------------------------------------
The following is my PHP program
<?php
function Intelli()
|
by: bdbeames |
last post by:
What I have is a is two sets of images,(Weather, optical) there is about 30 images of is each set.
I have script that will rotate through the images on the main page.
The user is able to view one or the other img sets with a simple onclick
This works great in Mozilla but in IE I get the error documentnull or not an object, line 95, char 4.
I've spent hours on this, but no luck.
|
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: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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...
| |