Hoşgeldin, Ziyaretçi |
Sitemizden yararlanabilmek için kayıt olmalısınız.
|
Kimler Çevrimiçi |
Şu anda 10 aktif kullanıcı var. » (0 Üye - 9 Ziyaretçi) Bing
|
Son Yazılanlar |
origami letters
Forum: Teknoloji
Son Yorum: MitziArguron
7 saat önce
» Yorum 0
» Okunma 1
|
AMD Ryzen 10000 Serisi Ze...
Forum: Kullanıcıların gönderdiği haberler
Son Yorum: admin
08-06-2025, 18:44
» Yorum 1
» Okunma 111
|
Samsung S24FE alınır mı?
Forum: Cep Telefonu
Son Yorum: admin
02-06-2025, 11:28
» Yorum 1
» Okunma 147
|
Google Pixel Cihazlarında...
Forum: Android ve Andorid Uygulamaları
Son Yorum: Aviatorder
26-05-2025, 18:52
» Yorum 1
» Okunma 2,690
|
Apple ios 19 ne zaman çık...
Forum: Donanım Haberleri
Son Yorum: admin
26-05-2025, 16:12
» Yorum 0
» Okunma 65
|
Linux Mint 22.2 Zara
Forum: Kullanıcıların gönderdiği haberler
Son Yorum: tekken29
26-05-2025, 11:50
» Yorum 1
» Okunma 101
|
Amiga Sensible World of S...
Forum: Commodore 64 Amiga Oyunları
Son Yorum: admin
19-05-2025, 00:43
» Yorum 0
» Okunma 102
|
Discord giremiyorum DNS o...
Forum: Online İletisim Araclari
Son Yorum: admin
19-05-2025, 00:33
» Yorum 1
» Okunma 119
|
Motor plakamı kaybettim d...
Forum: KONU DISI
Son Yorum: admin
17-05-2025, 19:23
» Yorum 3
» Okunma 132
|
Doğru tansiyon aleti nası...
Forum: Donanım İnceleme
Son Yorum: ademc
17-05-2025, 13:08
» Yorum 1
» Okunma 8,638
|
|
|
Uzayıp Kısalan Buton |
Yazar: ЯeboR - 12-03-2005, 22:13 - Forum: Java Script
- Yorum Yok
|
 |
Uzayıp Kısalan Buton
Bu script ile sayfanızda uzayıp kısalan butonlar yapabilirsiniz.
<BODY>..</BODY> arasına eklenecek kod :
<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] = "Geri Dön......."
urlArr[1] = "java2.htm"
lineArr[2] = "Ana Menü......."
urlArr[2] = "main.htm"
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>
<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>
|
|
|
Geri Dön Tuşu |
Yazar: ЯeboR - 12-03-2005, 22:11 - Forum: Java Script
- Yorum (1)
|
 |
Geri Dön Tuşu
Bu script ile sayfanızda bir geri tuşu oluşturabilirsiniz.
<BODY>..</BODY> arasına eklenecek kod:
<input onclick="history.back();" type="button" value="<<geri dön">
|
|
|
Hareketli Buton-1 |
Yazar: ЯeboR - 12-03-2005, 21:54 - Forum: Java Script
- Yorum Yok
|
 |
Hareketli Buton-1
Mouseu üzerine getirince hareket eden butonlar ister misiniz?
<HEAD>..</HEAD> arasına eklenecek kod :
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
pos = 15;
TO = null;
function shake_funct2(object,speed)
{
obj = eval(object)
txt = clear_space(obj.value);
if (pos == 15)
{
txt = txt + " ";
pos = -15;
}
else
{
txt = " " + txt;
pos = 15;
}
obj.value = txt;
obj.style.width = parseInt(obj.style.width) + pos;
obj = object
sp = speed
TO = setTimeout("shake_funct2(obj,sp)",speed);
}
function clear_space(text)
{
while (text.substring(0,1) == " ")
{
text = text.substring(1,text.length);
}
while(text.substring(text.length-1,text.length) == " ")
{
text = text.substring(0,text.length-1);
}
return text;
}
function end_shake_funct2(object)
{
clearTimeout(TO);
obj = eval(object);
txt = clear_space(obj.value);
obj.value = txt;
//alert(pos);
if (pos == -15)
{
obj.style.width = parseInt(obj.style.width) +15;
}
pos = 15
}
// End -->
</script>
<BODY>..</BODY> arasına eklenecek kod :
<form name=myform2>
<table border=0>
<tr><td>
Mouseu üzerine getirin
</td>
<td align=center width=160>
<input type=button value = "Yavaş" style="font-size:10;width:150" onmouseover="shake_funct2(this,100)" onmouseout="end_shake_funct2(this)">
</td></tr>
<tr><td>
Mouseu üzerine getirin
</td>
<td align=center width=160>
<input type=button value = "Hızlı" style="font-size:10;width:150" onmouseover="shake_funct2(this,50)" onmouseout="end_shake_funct2(this)">
</td></tr>
</Table>
</form>
|
|
|
Değişen Buton |
Yazar: ЯeboR - 12-03-2005, 21:47 - Forum: Java Script
- Yorum Yok
|
 |
Değişen Buton
Butonda belirtilen linkler sürekli değişiyor.
<HEAD>..</HEAD> arasına eklenecek kod :
<BASE TARGET="welcome">
<SCRIPT LANGUAGE="JavaScript">
var startTime =null;
var timerID =null;
var initial =new Date();
var pos =0;
var menuItem =null;
function initArray() {
this.length = initArray.arguments.length
for (var i = 0; i < this.length; i++) {
this[i+1] = initArray.arguments[i]
}
}
function parsemenuItem(data,num) {
for(var i=0;i<data.length;i++) {
if(data.substring(i,i+1)=="|") break;
}
if (num==0) return(data.substring(0,i));
else return(data.substring(i+1,data.length));
}
function startTimer() {
initial = new Date();
startTime=initial.getTime();
stopTimer();
menuItem = new initArray("Netscape|http://www.netscape.com",
"Microsoft|http://www.microsoft.com",
"BHS|http://www.bhs.com",
"Yahoo|http://www.yahoo.com",
"Excite|http://www.excite.com",
"Hotbot|http://www.hotbot.com",
"Online Solutions|http://www.onsol.com",
"Email|mailto:info@onsol.com"
);
showTimer();
}
function stopTimer() {
timerID=null;
menuItem=null;
}
function showTimer() {
pos= (pos == menuItem.length) ? 1 : pos + 1;
document.forms[0].elements[0].value=parsemenuItem(menuItem[pos],0);
timerID=window.setTimeout('showTimer()',1000);
}
function goToUrl() {
this.location=parsemenuItem(menuItem[pos],1);
return (false);
}
</SCRIPT>
<BODY>..</BODY> arasına eklenecek kod :
<FORM>
<INPUT TYPE="button" VALUE=" NEREYE? " NAME="goTo"
onClick="window.goToUrl()">
</FORM>
NOT : <body> tagını <BODY onLoad="window.startTimer()"> olarak değiştirin.
|
|
|
Buton-6 |
Yazar: ЯeboR - 12-03-2005, 21:34 - Forum: Java Script
- Yorum Yok
|
 |
Buton-6
Bu seferki buton örneğimiz windows butonlarını andırıyor.
<HEAD>..</HEAD> arasına eklenecek kod :
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var button = new Array();
var action = new Array();
var buttonWidth = new Array();
/////////////////////////////////////////////////////////////////////////////
/////////////////////// BEGIN OF EDITABLE SECTION /////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Edit this for your buttons text and actions.
// You can add or remove as much buttons as you want.
// Just be sure to use "button[number]", "buttonWidth[number]" and "action[number]"
// for each button, using the same button number for the three variables!
//
// Text format is: '...text...<u>underlined_letter</u>...text...';
// Important: Underline just ONE letter and be very carefull from
// NOT to use the same letter for more than one button!!
// Try also not to use letters that already have a function under
// the browser (i.e. If you use "e", you'll activate your button
// AND the already asigned combination for "EDIT" menu.)
//
// In the time you need to refer to some button on other scripts, each button
// has an id based on "bnumber". For example, button 1 has the id "b1".
//
// Let's use 5 buttons for this example:
button[1] = '<u>Y</u>ahoo';
buttonWidth[1] = 150; //This is the button's width, in pixels.
action[1] = function () {
// Place here you actions for button 1:
window.open('http://www.yahoo.com');
// End of actions for button 1.
}
button[2] = '<u>A</u>ltavista';
buttonWidth[2] = 150; //This is the button's width, in pixels.
action[2] = function () {
// Place here you actions for button 2:
window.open('http://www.altavista.com');
// End of actions for button 2.
}
button[3] = '<u>J</u>donanimmerkezi';
buttonWidth[3] = 150; //This is the button's width, in pixels.
action[3] = function () {
// Place here you actions for button 3:
window.open('http://www.donanimmerkezi.com');
// End of actions for button 3.
}
button[4] = 'Ntv<u>m</u>snbc Haber Portalı';
buttonWidth[4] = 150; //This is the button's width, in pixels.
action[4] = function () {
// Place here you actions for button 1:
window.open('http://www.ntvmsnbc.com');
// End of actions for button 1.
}
///////////////////////////////////////////////////////////////////////////
/////////////////////// END OF EDITABLE SECTION /////////////////////////// ///////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
// Don't edit bellow or you could get errors! //
////////////////////////////////////////////////////////////////////////////
function placeButton(value) {
if (button[value]) {
if (button[value].indexOf('<u>') != -1) {
document.write('<button id="b'+value+'" style="Width : '+buttonWidth[value]+'px ; Height : 22px" onClick="action['+value+']()"><font face="MS Sans Serif" size="1">'+button[value]+'</button>');
} else {
alert('You didn\'t specify the underlined letter for the button number '+value+'. This button cannot be placed until you specify the underlined letter by using <u> and </u> tags.');
}
} else {
alert('You are trying to place the button number '+value+', but you didn\'t declare its values on the variables area. \r\rThe button '+value+' will not be placed until you specify the variables "button['+value+']" and "action['+value+']".');
}
}
document.write('<script'+'>');
document.write('function myfocus(n) {');
for (a=1; a<button.length; a++) {
document.write('if (n=='+a+') {document.all.b'+a+'.focus()}'); } document.write('}'); document.write('<'+'/script>');
function chkKey(evt) {
var mykey, alt, ctrl, shift;
if (window.Event) {
mykey = evt.which;
alt = (evt.modifiers & Event.ALT_MASK) ? true : false;
ctrl = (evt.modifiers & Event.CONTROL_MASK) ? true : false;
shift = (evt.modifiers & Event.SHIFT_MASK) ? true : false;
} else {
mykey = evt.keyCode;
alt = evt.altKey;
ctrl = evt.ctrlKey;
shift = evt.shiftKey;
}
if (mykey!=0 && mykey!=16 && mykey!=17 && mykey!=18) {
if (alt) {
for (i=1; i<button.length; i++) {
ui = button[i].indexOf('<u>');
ul = button[i].substring(ui + 3, ui + 4).toLowerCase();
if (String.fromCharCode(mykey).toLowerCase() == ul) {
myfocus(i);
action[i]();
break;
}
}
}
}
return true;
}
if (window.Event) {
document.captureEvents(Event.KEYDOWN);
document.onkeydown = chkKey;
} else {
document.onkeydown = function() {
return chkKey(event);
}
}
// End -->
</script>
<BODY>..</BODY> arasına eklenecek kod :
<script>placeButton(1)</script>
<script>placeButton(2)</script>
<script>placeButton(3)</script>
<script>placeButton(4)</script>
NOT : Butonlarda kimi harflerin altının çizilebildiğine dikkat edin. 8) in yerine 8parantez yazacaksınız. Smillerin kısayolları ile çakıştığından bu şekilde görünmekte.
|
|
|
Arka Plan Animasyonu-3 |
Yazar: ЯeboR - 12-03-2005, 20:31 - Forum: Java Script
- Yorum Yok
|
 |
Arka Plan Animasyonu-3
Arka planda dönüp dolaşan bir daire.
<BODY>..</BODY> arasına eklenecek kod :
<script language="JavaScript">
<!-- Multi-Fx1 Script by kurt.grigg@virgin.net
dots=new Array('ff0000','00ff00','3366ff','ff00ff','ffa500','ffffff','fff000');
n=dots.length;
e=360/n;
n4=(document.layers);
n6=(document.getElementById&&!document.all);
ie=(document.all);
d=(n4||ie)?'document.':'document.getElementById("';
a=(n4||n6)?'':'all.';
r=(n6)?'")':'';
s=(n4)?'':'.style';
y=0;
x=0;
c1=0.1;
cs1=0;
c2=0.1;
cs2=0;
b=70;
if (n4){
for (i=0; i < n; i++)
document.write('<layer name="stars'+i+'" bgcolor='+dots[i]+' clip="0,0,2,2"></layer>');
}
else{
for (i=0; i < n; i++)
document.write('<span id="stars'+i+'" style="position:absolute;top:0;left:0;width:2px;height:2px;background:#'+dots[i]+';font-size:2px"></span>');
}
function fly(){
h=(n4||n6)?window.innerHeight:document.body.offsetHeight;
w=(n4||n6)?window.innerWidth:document.body.offsetWidth;
sy=(n4||n6)?window.pageYOffset:document.body.scrollTop;
sx=(n4||n6)?window.pageXOffset:document.body.scrollLeft;
v=(n4||n6)?3:3;
y=sy+h/2+h/v*Math.cos((cs2)/3)*Math.cos(cs2/50);
x=sx+w/2+w/2.4*Math.sin((cs2)/5)*Math.cos(cs2/30);
cs2+=c2;
}
function TwistnSpin(){
for (i=0; i < n; i++){
var divs=eval(d+a+"stars"+i+r+s);
divs.top=y+b*Math.cos(cs1+i*e*Math.PI/180)*Math.cos(cs1/1.5);
divs.left=x+b*Math.sin(cs1+i*e*Math.PI/180);
}
cs1+=c1;
fly();
setTimeout("TwistnSpin()",10);
}
function In(){
b-=0.5;
t1=setTimeout('In()',10);
if (b < 20){clearTimeout(t1);out()}
}
function out(){
b+=0.5;
t2=setTimeout('out()',10);
if (b > 70){clearTimeout(t2);In()}
}
function Go(){TwistnSpin();In()}
Go();
// -->
</script>
NOT : Scripti kullanacağınız sayfanın arka plan rengi koyu olmalı.
|
|
|
Tekli Seçim |
Yazar: ЯeboR - 12-03-2005, 18:59 - Forum: Java Script
- Yorum Yok
|
 |
Tekli Seçim
Ziyaretçinize iki açılır menü ile seçim sunacağınız bu scriptte iki menüde de aynı seçenekler olmasına rağmen bir seçenek ancak bir kez seçilebiliyor.
<HEAD>..</HEAD> arasına eklenecek kod :
PHP Kod: <SCRIPT LANGUAGE="JavaScript">
<!-- Begin var OptLstTxt = new Array; var OptLstVal = new Array; var OptLen = 0; function NoDupl(SelObjFrom, SelObjTo) { var OldToVal = SelObjTo.options[SelObjTo.selectedIndex].value; if (OptLen == 0) { OptLen = SelObjFrom.length; for (var i = 1; i < OptLen; i++) { OptLstTxt[i] = SelObjFrom.options[i].text; OptLstVal[i] = SelObjFrom.options[i].value; } } var j = 1; for (var i = 1; i < OptLen; i++) { if (OptLstVal[i] != SelObjFrom.options[SelObjFrom.selectedIndex].value) { if (j == SelObjTo.length) { SelObjTo.options[j] = new Option(OptLstTxt[i]); } else { SelObjTo.options[j].text = OptLstTxt[i]; } SelObjTo.options[j].value = OptLstVal[i]; if (OptLstVal[i] == OldToVal) { SelObjTo.selectedIndex = j; } j++; } } if (SelObjTo.length > j) SelObjTo.options[(SelObjTo.length - 1)] = null; } // End --> </script>
<BODY>..</BODY> arasına eklenecek kod :
<form method="POST" name="MForm">
<select name="Color_1" onChange="NoDupl(this,document.MForm.Color_2)">
<option selected>Birinci rengi seç</option> <option value='R'>Kırmızı</option> <option value='J'>Sarı</option> <option value='G'>Yeşil</option> <option value='B'>Mavi</option> </select> <select name="Color_2" onChange="NoDupl(this,document.MForm.Color_1)">
<option selected>İkinci rengi seç</option> <option value='R'>Kırmızı</option> <option value='J'>Sarı</option> <option value='G'>Yeşil</option> <option value='B'>Mavi</option> </select> </form>
|
|
|
Tarih Doğrulama |
Yazar: ЯeboR - 12-03-2005, 18:53 - Forum: Java Script
- Yorum Yok
|
 |
Tarih Doğrulama
Ziyaretçinizden istediğiniz tarih alanlarını istediğiniz biçime sokar, gün ve ayın doruluğunu denetler.
<HEAD>..</HEAD> arasına eklenecek kod :
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
// Check browser version
var isNav4 = false, isNav5 = false, isIE4 = false
var strSeperator = "/";
// If you are using any Java validation on the back side you will want to use the / because
// Java date validations do not recognize the dash as a valid date separator.
var vDateType = 3; // Global value for type of date format
// 1 = mm/dd/yyyy
// 2 = yyyy/dd/mm (Unable to do date check at this time)
// 3 = dd/mm/yyyy
var vYearType = 4; //Set to 2 or 4 for number of digits in the year for Netscape
var vYearLength = 2; // Set to 4 if you want to force the user to enter 4 digits for the year before validating.
var err = 0; // Set the error code to a default of zero
if(navigator.appName == "Netscape") {
if (navigator.appVersion < "5") {
isNav4 = true;
isNav5 = false;
}
else
if (navigator.appVersion > "4") {
isNav4 = false;
isNav5 = true;
}
}
else {
isIE4 = true;
}
function DateFormat(vDateName, vDateValue, e, dateCheck, dateType) {
vDateType = dateType;
// vDateName = object name
// vDateValue = value in the field being checked
// e = event
// dateCheck
// True = Verify that the vDateValue is a valid date
// False = Format values being entered into vDateValue only
// vDateType
// 1 = mm/dd/yyyy
// 2 = yyyy/mm/dd
// 3 = dd/mm/yyyy
//Enter a tilde sign for the first number and you can check the variable information.
if (vDateValue == "~") {
alert("AppVersion = "+navigator.appVersion+" \nNav. 4 Version = "+isNav4+" \nNav. 5 Version = "+isNav5+" \nIE Version = "+isIE4+" \nYear Type = "+vYearType+" \nDate Type = "+vDateType+" \nSeparator = "+strSeperator);
vDateName.value = "";
vDateName.focus();
return true;
}
var whichCode = (window.Event) ? e.which : e.keyCode;
// Check to see if a seperator is already present.
// bypass the date if a seperator is present and the length greater than 8
if (vDateValue.length > 8 && isNav4) {
if ((vDateValue.indexOf("-") >= 1) || (vDateValue.indexOf("/") >= 1))
return true;
}
//Eliminate all the ASCII codes that are not valid
var alphaCheck = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/-";
if (alphaCheck.indexOf(vDateValue) >= 1) {
if (isNav4) {
vDateName.value = "";
vDateName.focus();
vDateName.select();
return false;
}
else {
vDateName.value = vDateName.value.substr(0, (vDateValue.length-1));
return false;
}
}
if (whichCode == 8) //Ignore the Netscape value for backspace. IE has no value
return false;
else {
//Create numeric string values for 0123456789/
//The codes provided include both keyboard and keypad values
var strCheck = '47,48,49,50,51,52,53,54,55,56,57,58,59,95,96,97,98,99,100,101,102,103,104,105';
if (strCheck.indexOf(whichCode) != -1) {
if (isNav4) {
if (((vDateValue.length < 6 && dateCheck) || (vDateValue.length == 7 && dateCheck)) && (vDateValue.length >=1)) {
alert("Geçersiz Tarih\nLütfen Tekrar Girin");
vDateName.value = "";
vDateName.focus();
vDateName.select();
return false;
}
if (vDateValue.length == 6 && dateCheck) {
var mDay = vDateName.value.substr(2,2);
var mMonth = vDateName.value.substr(0,2);
var mYear = vDateName.value.substr(4,4)
//Turn a two digit year into a 4 digit year
if (mYear.length == 2 && vYearType == 4) {
var mToday = new Date();
//If the year is greater than 30 years from now use 19, otherwise use 20
var checkYear = mToday.getFullYear() + 30;
var mCheckYear = '20' + mYear;
if (mCheckYear >= checkYear)
mYear = '19' + mYear;
else
mYear = '20' + mYear;
}
var vDateValueCheck = mMonth+strSeperator+mDay+strSeperator+mYear;
if (!dateValid(vDateValueCheck)) {
alert("Geçersiz Tarih\nLütfen Tekrar Girin");
vDateName.value = "";
vDateName.focus();
vDateName.select();
return false;
}
return true;
}
else {
// Reformat the date for validation and set date type to a 1
if (vDateValue.length >= 8 && dateCheck) {
if (vDateType == 1) // mmddyyyy
{
var mDay = vDateName.value.substr(2,2);
var mMonth = vDateName.value.substr(0,2);
var mYear = vDateName.value.substr(4,4)
vDateName.value = mMonth+strSeperator+mDay+strSeperator+mYear;
}
if (vDateType == 2) // yyyymmdd
{
var mYear = vDateName.value.substr(0,4)
var mMonth = vDateName.value.substr(4,2);
var mDay = vDateName.value.substr(6,2);
vDateName.value = mYear+strSeperator+mMonth+strSeperator+mDay;
}
if (vDateType == 3) // ddmmyyyy
{
var mMonth = vDateName.value.substr(2,2);
var mDay = vDateName.value.substr(0,2);
var mYear = vDateName.value.substr(4,4)
vDateName.value = mDay+strSeperator+mMonth+strSeperator+mYear;
}
//Create a temporary variable for storing the DateType and change
//the DateType to a 1 for validation.
var vDateTypeTemp = vDateType;
vDateType = 1;
var vDateValueCheck = mMonth+strSeperator+mDay+strSeperator+mYear;
if (!dateValid(vDateValueCheck)) {
alert("Geçersiz Tarih\nLütfen Tekrar Girin");
vDateType = vDateTypeTemp;
vDateName.value = "";
vDateName.focus();
vDateName.select();
return false;
}
vDateType = vDateTypeTemp;
return true;
}
else {
if (((vDateValue.length < 8 && dateCheck) || (vDateValue.length == 9 && dateCheck)) && (vDateValue.length >=1)) {
alert("Geçersiz Tarih\nLütfen Tekrar Girin");
vDateName.value = "";
vDateName.focus();
vDateName.select();
return false;
}
}
}
}
else {
// Non isNav Check
if (((vDateValue.length < 8 && dateCheck) || (vDateValue.length == 9 && dateCheck)) && (vDateValue.length >=1)) {
alert("Geçersiz Tarih\nLütfen Tekrar Girin");
vDateName.value = "";
vDateName.focus();
return true;
}
// Reformat date to format that can be validated. mm/dd/yyyy
if (vDateValue.length >= 8 && dateCheck) {
// Additional date formats can be entered here and parsed out to
// a valid date format that the validation routine will recognize.
if (vDateType == 1) // mm/dd/yyyy
{
var mMonth = vDateName.value.substr(0,2);
var mDay = vDateName.value.substr(3,2);
var mYear = vDateName.value.substr(6,4)
}
if (vDateType == 2) // yyyy/mm/dd
{
var mYear = vDateName.value.substr(0,4)
var mMonth = vDateName.value.substr(5,2);
var mDay = vDateName.value.substr(8,2);
}
if (vDateType == 3) // dd/mm/yyyy
{
var mDay = vDateName.value.substr(0,2);
var mMonth = vDateName.value.substr(3,2);
var mYear = vDateName.value.substr(6,4)
}
if (vYearLength == 4) {
if (mYear.length < 4) {
alert("Geçersiz Tarih\nLütfen Tekrar Girin");
vDateName.value = "";
vDateName.focus();
return true;
}
}
// Create temp. variable for storing the current vDateType
var vDateTypeTemp = vDateType;
// Change vDateType to a 1 for standard date format for validation
// Type will be changed back when validation is completed.
vDateType = 1;
// Store reformatted date to new variable for validation.
var vDateValueCheck = mMonth+strSeperator+mDay+strSeperator+mYear;
if (mYear.length == 2 && vYearType == 4 && dateCheck) {
//Turn a two digit year into a 4 digit year
var mToday = new Date();
//If the year is greater than 30 years from now use 19, otherwise use 20
var checkYear = mToday.getFullYear() + 30;
var mCheckYear = '20' + mYear;
if (mCheckYear >= checkYear)
mYear = '19' + mYear;
else
mYear = '20' + mYear;
vDateValueCheck = mMonth+strSeperator+mDay+strSeperator+mYear;
// Store the new value back to the field. This function will
// not work with date type of 2 since the year is entered first.
if (vDateTypeTemp == 1) // mm/dd/yyyy
vDateName.value = mMonth+strSeperator+mDay+strSeperator+mYear;
if (vDateTypeTemp == 3) // dd/mm/yyyy
vDateName.value = mDay+strSeperator+mMonth+strSeperator+mYear;
}
if (!dateValid(vDateValueCheck)) {
alert("Geçersiz Tarih\nLütfen Tekrar Girin");
vDateType = vDateTypeTemp;
vDateName.value = "";
vDateName.focus();
return true;
}
vDateType = vDateTypeTemp;
return true;
}
else {
if (vDateType == 1) {
if (vDateValue.length == 2) {
vDateName.value = vDateValue+strSeperator;
}
if (vDateValue.length == 5) {
vDateName.value = vDateValue+strSeperator;
}
}
if (vDateType == 2) {
if (vDateValue.length == 4) {
vDateName.value = vDateValue+strSeperator;
}
if (vDateValue.length == 7) {
vDateName.value = vDateValue+strSeperator;
}
}
if (vDateType == 3) {
if (vDateValue.length == 2) {
vDateName.value = vDateValue+strSeperator;
}
if (vDateValue.length == 5) {
vDateName.value = vDateValue+strSeperator;
}
}
return true;
}
}
if (vDateValue.length == 10&& dateCheck) {
if (!dateValid(vDateName)) {
// Un-comment the next line of code for debugging the dateValid() function error messages
//alert(err);
alert("Geçersiz Tarih\nLütfen Tekrar Girin");
vDateName.focus();
vDateName.select();
}
}
return false;
}
else {
// If the value is not in the string return the string minus the last
// key entered.
if (isNav4) {
vDateName.value = "";
vDateName.focus();
vDateName.select();
return false;
}
else
{
vDateName.value = vDateName.value.substr(0, (vDateValue.length-1));
return false;
}
}
}
}
function dateValid(objName) {
var strDate;
var strDateArray;
var strDay;
var strMonth;
var strYear;
var intday;
var intMonth;
var intYear;
var booFound = false;
var datefield = objName;
var strSeparatorArray = new Array("-"," ","/",".");
var intElementNr;
// var err = 0;
var strMonthArray = new Array(12);
strMonthArray[0] = "Jan";
strMonthArray[1] = "Feb";
strMonthArray[2] = "Mar";
strMonthArray[3] = "Apr";
strMonthArray[4] = "May";
strMonthArray[5] = "Jun";
strMonthArray[6] = "Jul";
strMonthArray[7] = "Aug";
strMonthArray[8] = "Sep";
strMonthArray[9] = "Oct";
strMonthArray[10] = "Nov";
strMonthArray[11] = "Dec";
//strDate = datefield.value;
strDate = objName;
if (strDate.length < 1) {
return true;
}
for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++) {
if (strDate.indexOf(strSeparatorArray[intElementNr]) != -1) {
strDateArray = strDate.split(strSeparatorArray[intElementNr]);
if (strDateArray.length != 3) {
err = 1;
return false;
}
else {
strDay = strDateArray[0];
strMonth = strDateArray[1];
strYear = strDateArray[2];
}
booFound = true;
}
}
if (booFound == false) {
if (strDate.length>5) {
strDay = strDate.substr(0, 2);
strMonth = strDate.substr(2, 2);
strYear = strDate.substr(4);
}
}
//Adjustment for short years entered
if (strYear.length == 2) {
strYear = '20' + strYear;
}
strTemp = strDay;
strDay = strMonth;
strMonth = strTemp;
intday = parseInt(strDay, 10);
if (isNaN(intday)) {
err = 2;
return false;
}
intMonth = parseInt(strMonth, 10);
if (isNaN(intMonth)) {
for (i = 0;i<12;i++) {
if (strMonth.toUpperCase() == strMonthArray[i].toUpperCase()) {
intMonth = i+1;
strMonth = strMonthArray[i];
i = 12;
}
}
if (isNaN(intMonth)) {
err = 3;
return false;
}
}
intYear = parseInt(strYear, 10);
if (isNaN(intYear)) {
err = 4;
return false;
}
if (intMonth>12 || intMonth<1) {
err = 5;
return false;
}
if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12) && (intday > 31 || intday < 1)) {
err = 6;
return false;
}
if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intday > 30 || intday < 1)) {
err = 7;
return false;
}
if (intMonth == 2) {
if (intday < 1) {
err = 8;
return false;
}
if (LeapYear(intYear) == true) {
if (intday > 29) {
err = 9;
return false;
}
}
else {
if (intday > 28) {
err = 10;
return false;
}
}
}
return true;
}
function LeapYear(intYear) {
if (intYear % 100 == 0) {
if (intYear % 400 == 0) { return true; }
}
else {
if ((intYear % 4) == 0) { return true; }
}
return false;
}
// End -->
</script>
<BODY>..</BODY> arasına eklenecek kod :
<form name=dateTest>
<table border=0 width=400>
<tr>
<td>
<table align=center border=1 width=400>
<tr>
<td bgcolor=blue width=75%>
<font color=yellow>1. Tarih Þekli - aa/gg/yyyy Biçimi</font></td>
<td>
<input type="text" name="testDateFormat1" size='10' maxlength="10" onFocus="javascript:vDateType='1'" onKeyUp="DateFormat(this,this.value,event,false,'1')" onBlur="DateFormat(this,this.value,event,true,'1')">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table align=center border=1 width=400>
<tr>
<td bgcolor=blue width=75%>
<font color=yellow>2. Tarih Þekli - yyyy/aa/gg Biçimi</font></td>
<td>
<input type="text" name="testDateFormat3" size='10' maxlength="10" onFocus="javascript:vDateType='2'" onKeyUp="DateFormat(this,this.value,event,false,'2')" onBlur="DateFormat(this,this.value,event,true,'2')">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table align=center border=1 width=400>
<tr>
<td bgcolor=blue width=75%>
<font color=yellow>3. Tarih Þekli - gg/aa/yyyy Biçimi</font></td>
<td>
<input type="text" name="testDateFormat5" size='10' maxlength="10" onFocus="javascript:vDateType='3'" onKeyUp="DateFormat(this,this.value,event,false,'3')" onBlur="DateFormat(this,this.value,event,true,'3')">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
Tarihi yazın ve boş bir yere tıklayın.</td>
</tr>
</table>
</form>
NOT : <form name=dateTest>
<table border=0 width=400>
<tr>
<td>
<table align=center border=1 width=400>
<tr>
<td bgcolor=blue width=75%>
<font color=yellow>1. Tarih Þekli - aa/gg/yyyy Biçimi</font></td>
<td>
<input type="text" name="testDateFormat1" size='10' maxlength="10" onFocus="javascript:vDateType='1'" onKeyUp="DateFormat(this,this.value,event,false,'1')" onBlur="DateFormat(this,this.value,event,true,'1')">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table align=center border=1 width=400>
<tr>
<td bgcolor=blue width=75%>
<font color=yellow>2. Tarih Þekli - yyyy/aa/gg Biçimi</font></td>
<td>
<input type="text" name="testDateFormat3" size='10' maxlength="10" onFocus="javascript:vDateType='2'" onKeyUp="DateFormat(this,this.value,event,false,'2')" onBlur="DateFormat(this,this.value,event,true,'2')">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table align=center border=1 width=400>
<tr>
<td bgcolor=blue width=75%>
<font color=yellow>3. Tarih Þekli - gg/aa/yyyy Biçimi</font></td>
<td>
<input type="text" name="testDateFormat5" size='10' maxlength="10" onFocus="javascript:vDateType='3'" onKeyUp="DateFormat(this,this.value,event,false,'3')" onBlur="DateFormat(this,this.value,event,true,'3')">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
Tarihi yazın ve boş bir yere tıklayın.</td>
</tr>
</table>
</form>
[B]NOT : <body> tagını <body onLoad="document.dateTest.testDateFormat1.focus()"> olarak değiştirin. Ayrıca kodlarda görünen 8) smilenin yerine 8 Parantez yazılacaktır.
|
|
|
|