29 Åžub

Sitenizi Java Script Kodlari DinamikleÅŸtirin

javascript, scriptİnternet sitenizde java script kodları kullanın siteniz daha dinamik olsun. Sizler için seçtiğim ve sitelerimde kullandığım java script kodlarını şöyle sıralayayım.

1- Status Bar’da DeÄŸiÅŸen Yazılar


<script language=”JavaScript”>

<!–
// please keep these lines on when you copy the source
// made by: Eren ORTAKCI www.erenet.net
var currentmsg = 0
var MsgTime = 2000
var MsgEndTime = 4000

function initArray(n) {
this.length = n;
for (var i =1; i <= n; i++) {
this[i] = ‘ ‘
}
}

msg = new initArray(4)
msg[0]=”This is Message 1″
msg[1]=”Now it is Message 2″
msg[2]=”No, do not say I have to do 3 messages”
msg[3]=”Yeah, this message, 4, is the last”

function msgrotator() {
window.status = msg[currentmsg]

if (currentmsg > msg.length - 1) {
currentmsg = 0
setTimeout(”msgrotator()”, MsgEndTime)
}

else {
currentmsg = currentmsg + 1
setTimeout(”msgrotator()”, MsgTime)
}
}

msgrotator();
//–>

</script>

2-Ziyaretçiyi Selamlama

<SCRIPT LANGUAGE=”JavaScript”>
<!–
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 “here”;
i=document.cookie.indexOf(” “,i)+1;
if (i==0) break;
}
return null;
}
var visit=GetCookie(”shant”);
if (visit==null){
alert(”HoÅŸgeldiniz…”);
var expire=new Date();
expire=new
Date(expire.getTime()+7776000000);
document.cookie=”shant=here; expires=”+expire;
}
// –>
</SCRIPT>

3- Yönlendirme

<SCRIPT LANGUAGE=”JavaScript”>

//This Script is Copyright;Eren ORTAKCI© 2002
//If you are going to use this code, you MUST leave these
//lines of script UNEDITED!

var shant=”http://www.erenet.net”
document.write(’Please wait while you are forwarded to ‘ + shant)
function forPage()
{
location.href=shant
}
setTimeout (”forPage()”, 1000);

</SCRIPT>

4- Çözünürlük Ayarı

<SCRIPT LANGUAGE=”JavaScript”>
<!–
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 “here”;
i=document.cookie.indexOf(” “,i)+1;
if (i==0) break;
}
return null;
}
var visit=GetCookie(”shant”);
if (visit==null){
alert(”HoÅŸgeldiniz…”);
var expire=new Date();
expire=new
Date(expire.getTime()+7776000000);
document.cookie=”shant=here; expires=”+expire;
}
// –>
</SCRIPT>

5- Buton Åžeklinde Saat

<SCRIPT LANGUAGE=”JavaScript”>

<!– Script by: Eren ORTAKCI<erenett@mynet.com> –>
<!– Web Site: http://www.erenet.net –>

<!– Begin
day = new Date();
miVisit = day.getTime();
function clock() {
dayTwo = new Date();
hrNow = dayTwo.getHours();
mnNow = dayTwo.getMinutes();
scNow = dayTwo.getSeconds();
miNow = dayTwo.getTime();
if (hrNow == 0) {
hour = 12;
ap = ” AM”;
} else if(hrNow <= 11) {
ap = ” AM”;
hour = hrNow;
} else if(hrNow == 12) {
ap = ” PM”;
hour = 12;
} else if (hrNow >= 13) {
hour = (hrNow - 12);
ap = ” PM”;
}
if (hrNow >= 13) {
hour = hrNow - 12;
}
if (mnNow <= 9) {
min = “0″ + mnNow;
}
else (min = mnNow)
if (scNow <= 9) {
secs = “0″ + scNow;
} else {
secs = scNow;
}
time = hour + “:” + min + “:” + secs + ap;
document.form.button.value = time;
self.status = time;
setTimeout(’clock()’, 1000);
}
function timeInfo() {
milliSince = miNow;
milliNow = miNow - miVisit;
secsVisit = Math.round(milliNow / 1000);
minsVisit = Math.round((milliNow / 1000) / 60);
alert(”There have been ” + milliSince + ” milliseconds since midnight, January 1, 1970. ”
+ “You have spent ” + milliNow + ” of those milliseconds on this page. ”
+ “…. About ” + minsVisit + ” minutes, and ”
+ secsVisit + ” seconds.”);
}
document.write(”<form name=\”form\”>”
+ “<input type=button value=\”Click for info!\”"
+ ” name=button onClick=\”timeInfo()\”></form>”);
onError = null;
clock();

6- Renk Linkleri

<!– START OF SCRIPT –>
<!– For more scripts visit http://www.erenet.net –>
<a href=”" onMouseover=”document.bgColor=’red’”>Kırmızı</a><br><a href=”" onMouseover=”document.bgColor=’orange’”>Portakal</a><br> <a href=”" onMouseover=”document.bgColor=’yellow’”>Sarı</a><br> <a href=”" onMouseover=”document.bgColor=’green’”>YeÅŸil</a><br> <a href=”" onMouseover=”document.bgColor=’blue’”>Mavi</a><br> <a href=”" onMouseover=”document.bgColor=’purple’”>Mor</a><br>
<!– END OF SCRIPT –>

// End –>
</SCRIPT>

7- Search Menüsü

<SCRIPT>
<!– hide this script from non-JavaScript browsers

// All code in this script is Copyright(C) 2002, Eren ORTAKCI, erenett@mynet.com
// For documentation and more info, see: http://www.cs.cmu.edu/~jab/snark/
// This is SNARK Version 1.0, 18 May 1996

var MAX_ENGINES = 30;
var SNARK_STRING = “hunting+the+snark”;

function MakeArray(n) {
for (var i = 1; i <= n; i++) {
this[i] = 0;
}
this.maxlen = n;
this.len = 0;
return this;
}

var engs = new MakeArray(MAX_ENGINES);

function find_substring(needle, haystack) {
var i, needlen = needle.length, haylen = haystack.length;
for (i=0; i<=haylen-needlen; i++) {
if (needle == haystack.substring(i,i+needlen))
return i;
}
return false;
}

function Engine(name, opts, home, search) {
var snark = find_substring(SNARK_STRING, search);
this.name = name;
this.opts = opts;
this.home = home;
this.pre_snark = search.substring(0,snark);
this.post_snark= search.substring(snark+SNARK_STRING.length, search.length);
}

function Add(name, opts, home, search) {
engs.len++;
if (engs.len <= engs.maxlen) {
engs[engs.len] = new Engine(name, opts, home, search)
}
else {
alert(”Better increase MAX_ENGINES: ” + engs.len + “>” + engs.maxlen)
}
}

// ADD YOUR OWN SEARCH ENGINES BELOW. (See http://www.cs.cmu.edu/~jab/snark/ )

Add(”Netnews: AltaVista”, “”,
“http://altavista.digital.com/”,
“http://altavista.digital.com/cgi-bin/query?pg=q&what=news&fmt=d&q=hunting+the+snark” );

Add(”Shareware/Windows”, “”,
“http://vsl.cnet.com/”,
“http://vsl.cnet.com/cgi-bin/vsl-master/Find?category=MS-Windows%28all%29&search=hunting+the+snark&logop=and∧=&orfile=++&hits=200″ );

Add(”Shareware/Unix”, “”,
“http://vsl.cnet.com/”,
“http://vsl.cnet.com/cgi-bin/vsl-master/Find?category=UNIX&search=hunting+the+snark&logop=and∧=&orfile=++&hits=200″ );

Add(”the Web: AltaVista”, “SELECTED”,
“http://altavista.digital.com/”,
“http://altavista.digital.com/cgi-bin/query?pg=q&what=web&fmt=d&q=hunting+the+snark” );

Add(”the Web: Lycos”, “”,
“http://www.lycos.com/”,
“http://twelve.srv.lycos.com/cgi-bin/pursuit?query=hunting+the+snark” );

Add(”the Web: Yahoo!”, “”,
“http://www.yahoo.com/”,
“http://search.yahoo.com/bin/search?p=hunting+the+snark” );

Add(”Weather (City, ST)”, “”,
“http://www.nnic.noaa.gov/cgi-bin/page?pg=netcast”,
“http://www.nnic.noaa.gov/cgi-bin/netcast.do-it?state=hunting+the+snark&area=Local+Forecast&html=yes&match=strong”);

// ADD YOUR OWN SEARCH ENGINES ABOVE. (See http://www.cs.cmu.edu/~jab/snark/ )

function HandleForm(form) {
form.submit(); // This fixes a mysterious Netscape bug. Without this line,
// you can’t use <enter> to start the search the first time.
var i, oldq=form.query.value, newq=”";
for (i=0; i<oldq.length; i++) { // compress [ ]+ into \+
var thischar = oldq.charAt(i);
if (thischar != ‘ ‘)
newq += thischar;
else if (lastchar != ‘ ‘)
newq += ‘+’;
lastchar = thischar;
}
var eng = engs[1+form.service.selectedIndex];
location.href = newq ? eng.pre_snark + newq + eng.post_snark : eng.home;
}

function DisplayForm() {
document.writeln(’<CENTER><FORM OnSubmit=”HandleForm(this); return false”>’);
document.writeln(’Search <SELECT name=”service”>’);
for (i=1; i <= engs.len; i++) {
document.writeln(”<OPTION ” + engs[i].opts + “> ” + engs[i].name);
}
document.writeln(’</SELECT> for <INPUT size=26 name=”query”>’);
document.writeln(’<input type=submit value=” GO!”>’);
document.writeln(’</FORM> </CENTER>’);
}

DisplayForm();

// done hiding from old browsers –>

</SCRIPT>

8- Kutu İçinde Yazı

<!– START OF SCRIPT –>
<!– For more scripts visit http://www.erenet.net –>
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 3.2//EN”>

<HTML>
<HEAD>

<TITLE>Control Scroll</TITLE>
<META NAME=”KEYWORDS” CONTENT=”">
<META NAME=”GENERATOR” CONTENT=”HTMLpad”>

<script LANGUAGE=”javascript”>
var b_speed=10;
var banner_id=1;
var b_pause=0;
var b_position=0;
function stop(){
if(!b_pause){
clearTimeout(banner_id);
b_pause=1}
else{
banner_main();
b_pause=0}}
function banner_main(){
msg=”Buraya mesajınızı yazın…”
+”Burayada devam edin…www.erenet.net”;
var k=(35/msg.length)+-1;
for(var j=2;j<k;j++)msg+=”"+msg;

document.forms[0].substring.value=msg.substring(b_position,b_position+50);
if(b_position++==msg.length){
b_position=0}
banner_id=setTimeout(”banner_main()”,1000/b_speed)}

</script>

</HEAD>
<BODY BGCOLOR=”FFFFFF” TEXT=”000000″ LINK=”0000FF” VLINK=”800080″ ALINK=”FF0000″>
</head>
<CENTER>
<FORM NAME=”form” ACTION=”">
<INPUT TYPE=”text” NAME=”substring” SIZE=”35″>
<INPUT TYPE=”button” VALUE=”Start” ONCLICK=’{clearTimeout(banner_id); b_position=0; banner_main()}’>
<INPUT TYPE=”button” VALUE=”Slow” ONCLICK=’{if(b_speed<3){alert(”Going Slow”)}else{b_speed=b_speed-1}}’>
<INPUT TYPE=”button” VALUE=”Fast” ONCLICK=’{if(b_speed>21){alert(”Going Fast”)}else{b_speed=b_speed+2}}’>
<INPUT TYPE=”button” VALUE=”Pause/Reset” ONCLICK=’stop()’>

</form>
</center>
<!– END OF SCRIPT –>

9- Üste Doğru Kayan Yazı

<script language=”JavaScript”>

/**********************************************************************************
* Copyright 1999 William Goudy
* http://www.erenet.net - personal
* http://www.erenet.net
* erenett@mynet.com - Email (feel free to email me)
**********************************************************************************/

var mw=170 /* The width */
var mh=100 /* The height */
var sp=1 /* The Speed */

var text= ‘<B>1999.12.14</B> New <A href=”http://www.erenet.net”>Scribbler 2000</A> is available!<BR><BR><B>1999.12.12</B> <U>Only 19 days</U> left to Millennium<BR><BR>etc…’

if (document.all)document.write(’<marquee direction=”up” scrollAmount=’+sp+’ style=”width:’+mw+’;height:’+mh+’”>’+text+’</marquee>’)

function loop()
{
window.location.reload()
}

function loop2()
{
if (document.layers) { setTimeout(”window.onresize=loop”,350)
init()

}
}

function init()
{
document.marq.document.marqEx.document.write(text)
document.marq.document.marqEx.document.close()
thelength=document.marq.document.marqEx.document.height
runmarq()
}

function runmarq()
{
if (document.marq.document.marqEx.top>=thelength*(-1)) {
document.marq.document.marqEx.top-=sp
setTimeout(”runmarq()”,100)
}

else
{
document.marq.document.marqEx.top=mh
runmarq()

}
}

window.onload=loop2

</script>

10- Haraketli Buton Yapımı

<SCRIPT LANGUAGE=”JavaScript”>
<!–
var timerID = null
var timerRunning = false
var charNo = 0
var charMax = 0
var lineNo = 0
var lineMax = 2 // number of URL’s you will use
var lineArr = new Array(lineMax)
var urlArr = new Array(lineMax)
lineArr[1] = “Soft Lite”
urlArr[1] = “http://www.softlite.net/ps/”
lineArr[2] = “Soft Lite Mail”
urlArr[2] = “http://www.softlite.zzn.com”

var lineText = lineArr[1]

function StartShow() {
StopShow()
ShowLine()
timerRunning = true
}

function FillSpaces() {
for (var i = 1; i <= lineWidth; i++) {
spaces += ” ”
}
}

function StopShow() {
if (timerRunning) {
clearTimeout(timerID)
timerRunning = false
}
}

function ShowLine() {
if (charNo == 0) { // Next line
if (lineNo < lineMax) {
lineNo++
}
else {
lineNo = 1
}
lineText = lineArr[lineNo]
charMax = lineText.length
}
if (charNo <= charMax) { // Next char
document.formDisplay.buttonFace.value = lineText.substring(0, charNo)
charNo++
timerID = setTimeout(”ShowLine()”, 100)
}
else {
charNo = 0
timerID = setTimeout(”ShowLine()”, 3000)
}
}

function GotoUrl(url)
{
top.location.href = url
}
//–>
</SCRIPT>
</HEAD>
<BODY>
<SCRIPT LANGUAGE=”JavaScript”>
<!–
document.write(”<FORM NAME=\”formDisplay\”>”);
document.write(”<INPUT TYPE=\”BUTTON\” NAME=\”buttonFace\” VALUE=\”&{lineText}\” SIZE=\”18\” onClick=\”GotoUrl(urlArr[lineNo])\”>”);
document.write(”</FORM>”);
StartShow();
//–>
</SCRIPT>

Leave a Reply

eXTReMe Tracker