25 Ocak 2012 Çarşamba

Java Script Kullanıcı Adı Soran ve Cevap Veren Script


<script>
<!--
var caution = false
function setCookie(adi, value, expires, path, domain, secure)
{
var curCookie = adi + "=" + escape(value) +
((expires) ? "; expires=" + expires.toGMTString() : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "")
if (!caution || (adi + "=" + escape(value)).length <= 4000)
document.cookie = curCookie
else
if (confirm("Cookie exceeds 4KB and will be cut!"))
document.cookie = curCookie
}

function getCookie(adi)
{
var prefix = adi + "="
var cookieStartIndex = document.cookie.indexOf(prefix)
if (cookieStartIndex == -1)
return null
var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length)
if (cookieEndIndex == -1)
cookieEndIndex = document.cookie.length
return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex))
}

function deleteCookie(adi, path, domain) {
if (getCookie(adi))
{
document.cookie = adi + "=" +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
"; expires=Thu, 01-Jan-70 00:00:01 GMT"
}
}

function fixDate(date)
{
var base = new Date(0)
var skew = base.getTime()
if (skew > 0)
date.setTime(date.getTime() - skew)
}

var now = new Date()
fixDate(now)
now.setTime(now.getTime() + 31 * 24 * 60 * 60 * 1000)
var adi = getCookie("adi")
if (!adi)
adi = prompt("Lütfen Nickinizi giriniz:", "Sitemiz Sizi Bu İsimle Tanıyacaktır")
setCookie("adi", adi, now)
document.write("Sayın<b> " + adi + "!</b> Netinete Hoşgeldiniz.")
//-->
</script>

Açıklama :
Yukarıdaki kodları sayfanızda <body>..</body> takıları arasında istediğiniz yere koyabilirsiniz.
  
   İ.E. ve Netscape'de çalışır.


Hiç yorum yok:

Yorum Gönder