🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: pl.comp.lang.javascript
3 messages
3 total messages Started by Mariusz G. Thu, 27 Dec 2001 17:38
Cookies
#147
Author: Mariusz G.
Date: Thu, 27 Dec 2001 17:38
9 lines
1083 bytes
Witam

Mam prosbe. Czy moglby ktos mi pomoc i napisac script oblslugujacy Cookies.
Chodzi mi o to ze na form'ie mam textfield i chcialbym aby za kazdym razem
przy wejsciu na strone zapamietal wpis do tego TextField'u
Form Name: iAccInput
TextFiel Name: iName

Pozdrawiam
Re: Cookies
#148
Author: Jac.
Date: Fri, 28 Dec 2001 17:36
56 lines
2536 bytes
//--------------------------------------------------------------------------
---------------------------------

function setCookie(name, value, expire) { // ustawianie cookie
document.cookie = name + "=" + escape(value)
+ ((expire == null) ? "" : ("; expires=" + expire.toGMTString()))
}

//--------------------------------------------------------------------------
----------------------------------

function getCookie(Name) { //pobieranie zawartosci cookie
   var search = Name + "="
   if (document.cookie.length > 0) { // if there are any cookies
      offset = document.cookie.indexOf(search)
      if (offset != -1) { // if cookie exists
         offset += search.length
         // set index of beginning of value
         end = document.cookie.indexOf(";", offset)
         // set index of end of cookie value
         if (end == -1)
            end = document.cookie.length
         return unescape(document.cookie.substring(offset, end))
      }
   }
}


//--------------------------------------------------------------------------
---------------------------------

teraz tylko wystarczy, ze na onBlur zapiszesz ciacho a potem po odswiezeniu
pod value texfilda podstawisz zawartosc konkretnego ciacha.

Jac.







Użytkownik "Mariusz G." <cyclops@go2.pl> napisał w wiadomości
news:a0fmdq$f6u$1@news.tpi.pl...
> Witam
>
> Mam prosbe. Czy moglby ktos mi pomoc i napisac script oblslugujacy
Cookies.
> Chodzi mi o to ze na form'ie mam textfield i chcialbym aby za kazdym razem
> przy wejsciu na strone zapamietal wpis do tego TextField'u
> Form Name: iAccInput
> TextFiel Name: iName
>
> Pozdrawiam
>
>
Re: Cookies
#149
Author: Jac.
Date: Fri, 28 Dec 2001 17:40
56 lines
2536 bytes
//--------------------------------------------------------------------------
---------------------------------

function setCookie(name, value, expire) { // ustawianie cookie
document.cookie = name + "=" + escape(value)
+ ((expire == null) ? "" : ("; expires=" + expire.toGMTString()))
}

//--------------------------------------------------------------------------
----------------------------------

function getCookie(Name) { //pobieranie zawartosci cookie
   var search = Name + "="
   if (document.cookie.length > 0) { // if there are any cookies
      offset = document.cookie.indexOf(search)
      if (offset != -1) { // if cookie exists
         offset += search.length
         // set index of beginning of value
         end = document.cookie.indexOf(";", offset)
         // set index of end of cookie value
         if (end == -1)
            end = document.cookie.length
         return unescape(document.cookie.substring(offset, end))
      }
   }
}


//--------------------------------------------------------------------------
---------------------------------

teraz tylko wystarczy, ze na onBlur zapiszesz ciacho a potem po odswiezeniu
pod value texfilda podstawisz zawartosc konkretnego ciacha.

Jac.







Użytkownik "Mariusz G." <cyclops@go2.pl> napisał w wiadomości
news:a0fmdq$f6u$1@news.tpi.pl...
> Witam
>
> Mam prosbe. Czy moglby ktos mi pomoc i napisac script oblslugujacy
Cookies.
> Chodzi mi o to ze na form'ie mam textfield i chcialbym aby za kazdym razem
> przy wejsciu na strone zapamietal wpis do tego TextField'u
> Form Name: iAccInput
> TextFiel Name: iName
>
> Pozdrawiam
>
>
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads