Erre
29-11-2006, 19:08
Konu Yazarı: Batuhan Kırımlı
Yayın Tarihi: 29.KASIM.2006
Ders Konusu: Java Scriptler
Status Barda Tarih Yazdırmak için aşağıdaki kodları kullanınız.
<script language="JavaScript">
function doClock() {
window.setTimeout( "doClock()", 1000 );
today = new Date();
self.status = today.toString();
}
doClock()
</script>
Her Defada Farklı Resim açabilmemiz için aşağıdaki kodları kullanınız.
<SCRIPT LANGUAGE="JavaScript">
today=new Date();
jran=today.getTime();
function rnd() {
ia=9301;
ic=49297;
im=233280;
jran = (jran*ia+ic) % im;
return jran/(im*1.0);
};
function rand(number) {
return Math.ceil(rnd()*number);
};
document.write("<CENTER>");
for(i=1;i<=1;i++) {
myNum=(rand(12));
if(myNum == 1) document.write("<img src='header1.jpg'>");
if(myNum == 2) document.write("<img src='header2.jpg'>");
if(myNum == 3) document.write("<img src='header3.jpg'>");
if(myNum == 4) document.write("<img src='header4.jpg'>");
if(myNum == 5) document.write("<img src='header1.jpg'>");
if(myNum == 6) document.write("<img src='header2.jpg'>");
if(myNum == 7) document.write("<img src='header3.jpg'>");
if(myNum == 8) document.write("<img src='header4.jpg'>");
if(myNum == 9) document.write("<img src='header1.jpg'>");
if(myNum == 10) document.write("<img src='header2.jpg'>");
if(myNum == 11) document.write("<img src='header3.jpg'>");
if(myNum == 12) document.write("<img src='header4.jpg'>");
else {
document.write();
}
};
document.write("</CENTER>");
</SCRIPT>
Yeni Pencere Açmak için aşağıdaki kodları kullanabiliriz.
<FORM>
<input type="button" Value="Open Window" ONCLICK="window.open('[Sadece Kayıtlı Üyeler linkleri görebilir...]', 'Sample', 'toolbar=no,location=no,directories=yes,status=no, menubar=no,scrollbars=yes,resizable=no,copyhistory =yes,width=635,height=260')">
</FORM>
Ziyaretçiyi O Sayfayı Kaç Kere Ziyaret Ettiğini Öğrenmemiz için aşağıdaki kodları kullanabiliriz.
<script language="JavaScript">
function getCookieVal (offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0)
break;
}
return null;
}
function SetCookie (name, value) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (2 < argc) ? argv[2] : null;
var path = (3 < argc) ? argv[3] : null;
var domain = (4 < argc) ? argv[4] : null;
var secure = (5 < argc) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}
function DisplayInfo() {
var expdate = new Date();
var visit;
expdate.setTime(expdate.getTime() + (24 * 60 * 60 * 1000 * 365));
if(!(visit = GetCookie("visit")))
visit = 0;
visit++;
SetCookie("visit", visit, expdate, "/", null, false);
var message;
if(visit == 1)
message=" Sayfama Hos Geldin!";
if(visit== 2)
message=" Sayfama bir daha geldigin icin tesekkür ederim !";
if(visit == 3)
message=" Ooo,yine mi sen?";
if(visit == 4)
message=" Delirmis olmalisin!";
if(visit == 5)
message=" Sen tam bir manyaksin!";
if(visit == 6)
message=" Senin bir hobiye ihtiyacin var!";
if(visit == 7)
message=" Yapacak daha iyi biseyler yok mu?";
if(visit == 8)
message=" Hiç uyumaz misin?";
if(visit == 9)
message=" Hayatin tadina baksana olm sen yaw!!!";
if(visit >= 10)
message=" Tamam tamam istedigin kadar gelebilirsin !";
alert("\n"+"Tarayiciniz bu sayfaya tam \n"
+" "+visit+"\n" +" kere ugramis. -TESEKKÜRLER-."+"\n"+"\n"
+message);
}
function ResetCounts() {
var expdate = new Date();
expdate.setTime(expdate.getTime() + (24 * 60 * 60 * 1000 * 365));
visit = 0;
SetCookie("visit", visit, expdate , "/", null, false);
history.go(0);
}
window.onload=DisplayInfo
</script>
<form>
<p align="center"><input type="button" name="update"
value="Tekrar Ziyaret Et" onclick="history.go(0)"> <input
type="button" name="reset" value="Sayaci Sifirla"
onclick="ResetCounts()"> </p>
</form>exOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0)
break;
}
return null;
}
function SetCookie (name, value) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (2 < argc) ? argv[2] : null;
var path = (3 < argc) ? argv[3] : null;
var domain = (4 < argc) ? argv[4] : null;
var secure = (5 < argc) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}
function DisplayInfo() {
var expdate = new Date();
var visit;
expdate.setTime(expdate.getTime() + (24 * 60 * 60 * 1000 * 365));
if(!(visit = GetCookie("visit")))
visit = 0;
visit++;
SetCookie("visit", visit, expdate, "/", null, false);
var message;
if(visit == 1)
message=" Sayfama Hos Geldin!";
if(visit== 2)
message=" Sayfama bir daha geldigin icin tesekkür ederim !";
if(visit == 3)
message=" Ooo,yine mi sen?";
if(visit == 4)
message=" Delirmis olmalisin!";
if(visit == 5)
message=" Sen tam bir manyaksin!";
if(visit == 6)
message=" Senin bir hobiye ihtiyacin var!";
if(visit == 7)
message=" Yapacak daha iyi biseyler yok mu?";
if(visit == 8)
message=" Hiç uyumaz misin?";
if(visit == 9)
message=" Hayatin tadina baksana olm sen yaw!!!";
if(visit >= 10)
message=" Tamam tamam istedigin kadar gelebilirsin !";
alert("\n"+"Tarayiciniz bu sayfaya tam \n"
+" "+visit+"\n" +" kere ugramis. -TESEKKÜRLER-."+"\n"+"\n"
+message);
}
function ResetCounts() {
var expdate = new Date();
expdate.setTime(expdate.getTime() + (24 * 60 * 60 * 1000 * 365));
visit = 0;
SetCookie("visit", visit, expdate , "/", null, false);
history.go(0);
}
window.onload=DisplayInfo
</script>
<form>
<p align="center"><input type="button" name="update"
value="Tekrar Ziyaret Et" onclick="history.go(0)"> <input
type="button" name="reset" value="Sayaci Sifirla"
onclick="ResetCounts()"> </p>
</form>
Giriş Onaylatmak için kullanacağımız kodlar aşağıda belirtmiş bulunuyoruz.
<SCRIPT LANGUAGE="JavaScript">
<!-- Beginning of JavaScript Applet<-- begin to hide script contents from old browsers.
function Info()
{if (!confirm("Su anda Sahane bir sayfaya giriyorsunuz. Kabul mu?"))
history.go(0);return " "}
document.writeln(Info())<!--End-->
</SCRIPT>
Yazılarımızın Sabah Siyah Akşam Beyaz Olmasını Sağlamak istiyorsak aşağıda vermiş olduğum kodları kullanarak bunları yapmış oluruz...
SCRIPT LANGUAGE="JavaScript">
now = new Date();
if ((now.getHours() > 5) && (now.getHours() < 18))
{
document.bgColor='white'
document.fgColor='black'
document.linkColor='red'
}
else
{
document.bgColor='black'
document.fgColor='white'
document.linkColor='red'
}
</SCRIPT>
Internet Explorer Çubuğunda Kayan Yazı oluşturmamız için aşağıdaki kodları kullanabiliriz.
<!-- This scrolls ' Your Message Here ' in the status bar -->
<SCRIPT LANGUAGE="JavaScript">
//Modified by fmtr.net
function infoscroll(seed,looped)
{
var text1 = " [Sadece Kayıtlı Üyeler linkleri görebilir...] ";
var text2 = " [Sadece Kayıtlı Üyeler linkleri görebilir...] ";
var msg=text1+text2;
var putout = " ";
var c = 1;
if (looped > 10)
{ window.status="<Thanks !>"; }
else if (seed > 100)
{
seed--;
var cmd="infoscroll(" + seed + "," + looped + ")";
timerTwo=window.setTimeout(cmd,100);
}
else if (seed <= 100 && seed > 0)
{
for (c=0 ; c < seed ; c++)
{ putout+=" "; }
putout+=msg.substring(0,100-seed);
seed--;
var cmd="infoscroll(" + seed + "," + looped + ")";
window.status=putout;
timerTwo=window.setTimeout(cmd,100);
}
else if (seed <= 0)
{
if (-seed < msg.length)
{
putout+=msg.substring(-seed,msg.length);
seed--;
var cmd="infoscroll(" + seed + "," + looped + ")";
window.status=putout;
timerTwo=window.setTimeout(cmd,100); // 100
}
else
{
window.status=" ";
looped += 1;
var cmd = "infoscroll(100," + looped + ")";
timerTwo=window.setTimeout(cmd,75); // 75
}
}
}
// -->
<!--
infoscroll(100,1)
// -->
</SCRIPT>
Şimdilik bu kadar java script hakkında yazmış olduğum kodları yeterli buluyorum ileri günlerde sizlerle daha çok paylaşımlarım, eğlenceli scriptleri sunacağım iyi çalışmalar dilerim...
Yayın Tarihi: 29.KASIM.2006
Ders Konusu: Java Scriptler
Status Barda Tarih Yazdırmak için aşağıdaki kodları kullanınız.
<script language="JavaScript">
function doClock() {
window.setTimeout( "doClock()", 1000 );
today = new Date();
self.status = today.toString();
}
doClock()
</script>
Her Defada Farklı Resim açabilmemiz için aşağıdaki kodları kullanınız.
<SCRIPT LANGUAGE="JavaScript">
today=new Date();
jran=today.getTime();
function rnd() {
ia=9301;
ic=49297;
im=233280;
jran = (jran*ia+ic) % im;
return jran/(im*1.0);
};
function rand(number) {
return Math.ceil(rnd()*number);
};
document.write("<CENTER>");
for(i=1;i<=1;i++) {
myNum=(rand(12));
if(myNum == 1) document.write("<img src='header1.jpg'>");
if(myNum == 2) document.write("<img src='header2.jpg'>");
if(myNum == 3) document.write("<img src='header3.jpg'>");
if(myNum == 4) document.write("<img src='header4.jpg'>");
if(myNum == 5) document.write("<img src='header1.jpg'>");
if(myNum == 6) document.write("<img src='header2.jpg'>");
if(myNum == 7) document.write("<img src='header3.jpg'>");
if(myNum == 8) document.write("<img src='header4.jpg'>");
if(myNum == 9) document.write("<img src='header1.jpg'>");
if(myNum == 10) document.write("<img src='header2.jpg'>");
if(myNum == 11) document.write("<img src='header3.jpg'>");
if(myNum == 12) document.write("<img src='header4.jpg'>");
else {
document.write();
}
};
document.write("</CENTER>");
</SCRIPT>
Yeni Pencere Açmak için aşağıdaki kodları kullanabiliriz.
<FORM>
<input type="button" Value="Open Window" ONCLICK="window.open('[Sadece Kayıtlı Üyeler linkleri görebilir...]', 'Sample', 'toolbar=no,location=no,directories=yes,status=no, menubar=no,scrollbars=yes,resizable=no,copyhistory =yes,width=635,height=260')">
</FORM>
Ziyaretçiyi O Sayfayı Kaç Kere Ziyaret Ettiğini Öğrenmemiz için aşağıdaki kodları kullanabiliriz.
<script language="JavaScript">
function getCookieVal (offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0)
break;
}
return null;
}
function SetCookie (name, value) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (2 < argc) ? argv[2] : null;
var path = (3 < argc) ? argv[3] : null;
var domain = (4 < argc) ? argv[4] : null;
var secure = (5 < argc) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}
function DisplayInfo() {
var expdate = new Date();
var visit;
expdate.setTime(expdate.getTime() + (24 * 60 * 60 * 1000 * 365));
if(!(visit = GetCookie("visit")))
visit = 0;
visit++;
SetCookie("visit", visit, expdate, "/", null, false);
var message;
if(visit == 1)
message=" Sayfama Hos Geldin!";
if(visit== 2)
message=" Sayfama bir daha geldigin icin tesekkür ederim !";
if(visit == 3)
message=" Ooo,yine mi sen?";
if(visit == 4)
message=" Delirmis olmalisin!";
if(visit == 5)
message=" Sen tam bir manyaksin!";
if(visit == 6)
message=" Senin bir hobiye ihtiyacin var!";
if(visit == 7)
message=" Yapacak daha iyi biseyler yok mu?";
if(visit == 8)
message=" Hiç uyumaz misin?";
if(visit == 9)
message=" Hayatin tadina baksana olm sen yaw!!!";
if(visit >= 10)
message=" Tamam tamam istedigin kadar gelebilirsin !";
alert("\n"+"Tarayiciniz bu sayfaya tam \n"
+" "+visit+"\n" +" kere ugramis. -TESEKKÜRLER-."+"\n"+"\n"
+message);
}
function ResetCounts() {
var expdate = new Date();
expdate.setTime(expdate.getTime() + (24 * 60 * 60 * 1000 * 365));
visit = 0;
SetCookie("visit", visit, expdate , "/", null, false);
history.go(0);
}
window.onload=DisplayInfo
</script>
<form>
<p align="center"><input type="button" name="update"
value="Tekrar Ziyaret Et" onclick="history.go(0)"> <input
type="button" name="reset" value="Sayaci Sifirla"
onclick="ResetCounts()"> </p>
</form>exOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0)
break;
}
return null;
}
function SetCookie (name, value) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (2 < argc) ? argv[2] : null;
var path = (3 < argc) ? argv[3] : null;
var domain = (4 < argc) ? argv[4] : null;
var secure = (5 < argc) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}
function DisplayInfo() {
var expdate = new Date();
var visit;
expdate.setTime(expdate.getTime() + (24 * 60 * 60 * 1000 * 365));
if(!(visit = GetCookie("visit")))
visit = 0;
visit++;
SetCookie("visit", visit, expdate, "/", null, false);
var message;
if(visit == 1)
message=" Sayfama Hos Geldin!";
if(visit== 2)
message=" Sayfama bir daha geldigin icin tesekkür ederim !";
if(visit == 3)
message=" Ooo,yine mi sen?";
if(visit == 4)
message=" Delirmis olmalisin!";
if(visit == 5)
message=" Sen tam bir manyaksin!";
if(visit == 6)
message=" Senin bir hobiye ihtiyacin var!";
if(visit == 7)
message=" Yapacak daha iyi biseyler yok mu?";
if(visit == 8)
message=" Hiç uyumaz misin?";
if(visit == 9)
message=" Hayatin tadina baksana olm sen yaw!!!";
if(visit >= 10)
message=" Tamam tamam istedigin kadar gelebilirsin !";
alert("\n"+"Tarayiciniz bu sayfaya tam \n"
+" "+visit+"\n" +" kere ugramis. -TESEKKÜRLER-."+"\n"+"\n"
+message);
}
function ResetCounts() {
var expdate = new Date();
expdate.setTime(expdate.getTime() + (24 * 60 * 60 * 1000 * 365));
visit = 0;
SetCookie("visit", visit, expdate , "/", null, false);
history.go(0);
}
window.onload=DisplayInfo
</script>
<form>
<p align="center"><input type="button" name="update"
value="Tekrar Ziyaret Et" onclick="history.go(0)"> <input
type="button" name="reset" value="Sayaci Sifirla"
onclick="ResetCounts()"> </p>
</form>
Giriş Onaylatmak için kullanacağımız kodlar aşağıda belirtmiş bulunuyoruz.
<SCRIPT LANGUAGE="JavaScript">
<!-- Beginning of JavaScript Applet<-- begin to hide script contents from old browsers.
function Info()
{if (!confirm("Su anda Sahane bir sayfaya giriyorsunuz. Kabul mu?"))
history.go(0);return " "}
document.writeln(Info())<!--End-->
</SCRIPT>
Yazılarımızın Sabah Siyah Akşam Beyaz Olmasını Sağlamak istiyorsak aşağıda vermiş olduğum kodları kullanarak bunları yapmış oluruz...
SCRIPT LANGUAGE="JavaScript">
now = new Date();
if ((now.getHours() > 5) && (now.getHours() < 18))
{
document.bgColor='white'
document.fgColor='black'
document.linkColor='red'
}
else
{
document.bgColor='black'
document.fgColor='white'
document.linkColor='red'
}
</SCRIPT>
Internet Explorer Çubuğunda Kayan Yazı oluşturmamız için aşağıdaki kodları kullanabiliriz.
<!-- This scrolls ' Your Message Here ' in the status bar -->
<SCRIPT LANGUAGE="JavaScript">
//Modified by fmtr.net
function infoscroll(seed,looped)
{
var text1 = " [Sadece Kayıtlı Üyeler linkleri görebilir...] ";
var text2 = " [Sadece Kayıtlı Üyeler linkleri görebilir...] ";
var msg=text1+text2;
var putout = " ";
var c = 1;
if (looped > 10)
{ window.status="<Thanks !>"; }
else if (seed > 100)
{
seed--;
var cmd="infoscroll(" + seed + "," + looped + ")";
timerTwo=window.setTimeout(cmd,100);
}
else if (seed <= 100 && seed > 0)
{
for (c=0 ; c < seed ; c++)
{ putout+=" "; }
putout+=msg.substring(0,100-seed);
seed--;
var cmd="infoscroll(" + seed + "," + looped + ")";
window.status=putout;
timerTwo=window.setTimeout(cmd,100);
}
else if (seed <= 0)
{
if (-seed < msg.length)
{
putout+=msg.substring(-seed,msg.length);
seed--;
var cmd="infoscroll(" + seed + "," + looped + ")";
window.status=putout;
timerTwo=window.setTimeout(cmd,100); // 100
}
else
{
window.status=" ";
looped += 1;
var cmd = "infoscroll(100," + looped + ")";
timerTwo=window.setTimeout(cmd,75); // 75
}
}
}
// -->
<!--
infoscroll(100,1)
// -->
</SCRIPT>
Şimdilik bu kadar java script hakkında yazmış olduğum kodları yeterli buluyorum ileri günlerde sizlerle daha çok paylaşımlarım, eğlenceli scriptleri sunacağım iyi çalışmalar dilerim...
