| | |
How do I place a "remember me" cookie in my website ???
Please support our HTML and CSS advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Dec 2008
Posts: 7
Reputation:
Solved Threads: 0
I have developed a New Website in HTML. Its a Multi Location or Country Website. For the same I have created the Welcome Page where it will show the list of countries available and I need to place a Remember me Check box so that next time the same computer visit my website it will not have to choose its country and will be directed to the country which it had chosen earlier.
Please tell me How can I place a cookie there. Really I don't have any Idea about cookies nor I know how to create them.
Please help me.
Please tell me How can I place a cookie there. Really I don't have any Idea about cookies nor I know how to create them.
Please help me.
•
•
Join Date: Dec 2008
Posts: 1
Reputation:
Solved Threads: 0
You place this in index.html
. . .
<script type="text/javascript" language="JavaScript">
function cookie1(){
var sadrzaj = document.cookie;
var ime = 'kukac';
var pocetak = sadrzaj.indexOf(ime);
if(pocetak!=-1)
{
var kraj= sadrzaj.indexOf(";", pocetak);
if(kraj==-1){kraj=sadrzaj.length}
pocetak += ime.length + 1;
var vrijednost = sadrzaj.substring(pocetak, kraj);
alert("Cookie procitan: " + vrijednost);
}
else{
var dani = 7;
var datum = new Date();
datum.setTime(datum.getTime()+(dani*24*60*60*1000));
var istjecanje;
istjecanje=datum.toGMTString();
var ispis;
ispis = ime +" = " + ime + "; expires=" + istjecanje + "; path=/" ;
document.cookie = ispis;
alert( "Cookie kreiran: \n" + ispis);
}
}
</script>
. . .
<script type="text/javascript" language="JavaScript">
function cookie1(){
var sadrzaj = document.cookie;
var ime = 'kukac';
var pocetak = sadrzaj.indexOf(ime);
if(pocetak!=-1)
{
var kraj= sadrzaj.indexOf(";", pocetak);
if(kraj==-1){kraj=sadrzaj.length}
pocetak += ime.length + 1;
var vrijednost = sadrzaj.substring(pocetak, kraj);
alert("Cookie procitan: " + vrijednost);
}
else{
var dani = 7;
var datum = new Date();
datum.setTime(datum.getTime()+(dani*24*60*60*1000));
var istjecanje;
istjecanje=datum.toGMTString();
var ispis;
ispis = ime +" = " + ime + "; expires=" + istjecanje + "; path=/" ;
document.cookie = ispis;
alert( "Cookie kreiran: \n" + ispis);
}
}
</script>
![]() |
Other Threads in the HTML and CSS Forum
- Previous Thread: grrr... can someone take a look?
- Next Thread: DreamWeaver 8: FTP information does not save for sites
| Thread Tools | Search this Thread |
Tag cloud for HTML and CSS
appointments asp background backgroundcolor beta browser bug calendar cart cgi code codeinjection corporateidentity css design development displayimageinsteadofflash dreamweaver emailmarketing epilepsy explorer firefox flash font fonts form format google griefers hackers hitcounter hover html ide ie7 ie8 iframe image images internet internetexplorer intranet iphone javascript jpeg layout macbook maps marketshare microsoft mozilla multimedia navigationbars news offshoreoutsourcingcompany opacity opera optimization perl pnginie6 positioning problem scroll seo shopping studio swf swf. textcolor timecolor titletags url urlseparatedwords visual visualization web webdevelopment webform website windows7 xml xsl





