JavaScript Nesneler

JavaScript nesneler gizleme
<script type=”text/javascript”>
function toggle_visibility(id) {
var e = document.getElementById(id).style.display;
if ((e == ‘block’) || (e == ”)) { e = ‘none’; }
else { e.style.display = ‘block’; }
}
</script>
//—————————————————————————————
Bazı dururmlarda resimlerin yüklenmesi uzun sürebilir. JavaScript nesneler kullanarak resimleri preload yani önyükleme yapabilirsiniz.
<SCRIPT LANGUAGE=”JavaScript”>
<!– hide from none JavaScript Browsers

Image1= new Image(175,50)
Image1.src = “image1.gif”

Image2 = new Image(25,30)
Image2.src = “image2.gif”

Image3 = new Image(125,80)
Image3.src = “image3.gif”

// End Hiding –>
</SCRIPT>
//—————————————————————-
//
<script language=”JavaScript”>
<!–
YourPicture = new Image();
YourPicture.src=http://yourwebsite.com/yourimage.jpg;
//–>
</script>
//——————————————————————–
<script language=”JavaScript” type=”text/JavaScript”>
<!–
function Preload() {
var args = simplePreload.arguments;
document.imageArray = new Array(args.length);
for(var i=0; i<args.length; i++) {
document.imageArray[i] = new Image;
document.imageArray[i].src = args[i];
}
}
–>
</script>

html sayfa body içine <body onLoad=”Preload(‘image1.jpg’, ‘image2.gif’, ‘image3.png’, …)”>web sayfanızın gövdesi </body>

JavaScript görünmezlik:
var m = document.getElementById(mmOpenMenus[i]);
m.style.visibility = “hidden”;
var c = document.getElementById(containName);
var s = c.style;
s.visibility = “inherit”;
<div id=”MainDiv” align=”center”  style=”visibility: hidden;”>
//——————————————————–

JavaScript nesneler ile html sayfasının en sonuna gitme :

function toBottom()

{

nDiv = document.getElementById(‘div1’);
setTimeout(“nDiv.scrollTop = nDiv.scrollHeight”,1);
}

onload=toBottom;

JavaScript url encode: encodeURIComponent(vMesaj.value);

JavaScipt Firefox sayfa tarayıcı dedekt ve sayfa yenileme:

if(navigator.userAgent.indexOf(“Firefox”)!=-1 ) window.location.reload(true);

JavaScript string to int convert string değişken türünü sayıya çevirme :

parseInt(‘123.45′)  // 123
parseInt(’77’)      // 77
parseInt(‘077′,10)  // 77
parseInt(’77’,8)    // 63  (= 7 + 7*8)
parseInt(‘077′)     // 63  (= 7 + 7*8)
parseInt(’77’,16)   // 119 (= 7 + 7*16)
parseInt(‘0x77’)    // 119 (= 7 + 7*16)
parseInt(‘099′)     // 0 (9 is not an octal digit)
parseInt(’99’,8)    // 0 or NaN, depending on the platform
parseInt(‘0.1e6’)   // 0
parseInt(‘ZZ’,36)   // 1295 (= 35 + 35*36)

JavaScript setText fonksion

function setHtml(a,b){
x = document.getElementById(a);
if(x) x.innerHTML = b.options[b.selectedIndex].innerHTML;
}
———————
style=”background:URL(images/back_input.gif); background-repeat:repeat-x; background-color:#F1F1F1 ”

JavaScript nesneler kullanıılarak, window ile sayfa yeniden yüklenebilir yani refresh edilebilir.
window.location.reload(true);
======================================================
onClick=”OpenLayer(‘showlog.php?auth=<? echo $auth ?>&token=<? echo rand(1,123)?>’)” style=”cursor: pointer; cursor: hand;”
background-color: #88FFFF url(notes/buttonfon.gif)  top left no-repeat ;
//durum çubuğu

JavaScript nesneler ile window durumu değiştirilmesi: onmouseout=”window.status=’selam’;”
//——————————————————————————————
//öncelikli resimler için
<body onload=”MM_preloadImages(‘images/help_f2.png’,’images/archive_f2.png’)”>
//—————————————————————————————-
//eski browserlar için css import
<style type=”text/css”>
@import url(templates/joomla_admin/css/admin_login.css);
</style>

<a href=”javascript:;” onclick=”dw_scrollObj.scrollTo(‘wn’,540,0); return false”>4</a>
//———————————————————————————————-
// resim üzerine gelince sönük yapma, ayrılınca net tersi
function high(which2){
var theobject=which2;
//highlighting=setInterval(highlightit(theobject),50);
if(which2.style.MozOpacity)
which2.style.MozOpacity=1;
else if (which2.filters)
which2.filters.alpha.opacity=100;
}
function low(which2){
//clearInterval(highlighting);
if(which2.style.MozOpacity)
which2.style.MozOpacity=0.3;
else if (which2.filters)
which2.filters.alpha.opacity=60;
}

//———————————————————————————————————–
//ie7 de javascript (ajax) çalışması için :
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>

JavaScrippt yes no sorgusu:
onclick=”if(window.confirm(‘İletişim bilgilerinizi silmek istediğinizden emin misiniz?’)) window.navigate(‘/address.aspx?action=delete’);”

JavaScript switch case:
switch (red) {
case 1: result = ‘one’; break;
case 2: result = ‘two’; break;
default: result = ‘unknown’;
}

[:en]Hiding JavaScript objects
<script type=”text/javascript”>
function toggle_visibility(id) {
var e = document.getElementById(id).style.display;
if ((e == ‘block’) || (e == ”)) { e = ‘none’; }
else { e.style.display = ‘block’; }
}
</script>

Images may take a long time to load at some stops. You can preload your images using JavaScript objects ie preload.
<SCRIPT LANGUAGE=”JavaScript”>
<!– hide from none JavaScript Browsers

Image1= new Image(175,50)
Image1.src = “image1.gif”

Image2 = new Image(25,30)
Image2.src = “image2.gif”

Image3 = new Image(125,80)
Image3.src = “image3.gif”

// End Hiding –>
</SCRIPT>

<script language=”JavaScript”>
<!–
YourPicture = new Image();
YourPicture.src=http://yourwebsite.com/yourimage.jpg;
//–>
</script>
//——————————————————————–
<script language=”JavaScript” type=”text/JavaScript”>
<!–
function Preload() {
var args = simplePreload.arguments;
document.imageArray = new Array(args.length);
for(var i=0; i<args.length; i++) {
document.imageArray[i] = new Image;
document.imageArray[i].src = args[i];
}
}
–>
</script>

html sayfa body içine <body onLoad=”Preload(‘image1.jpg’, ‘image2.gif’, ‘image3.png’, …)”>web sayfanızın gövdesi </body>

JavaScript görünmezlik:
var m = document.getElementById(mmOpenMenus[i]);
m.style.visibility = “hidden”;
var c = document.getElementById(containName);
var s = c.style;
s.visibility = “inherit”;
<div id=”MainDiv” align=”center”  style=”visibility: hidden;”>
//——————————————————–

JavaScript nesneler ile html sayfasının en sonuna gitme :

function toBottom()

{

nDiv = document.getElementById(‘div1’);
setTimeout(“nDiv.scrollTop = nDiv.scrollHeight”,1);
}

onload=toBottom;

JavaScript url encode: encodeURIComponent(vMesaj.value);

JavaScipt Firefox sayfa tarayıcı dedekt ve sayfa yenileme:

if(navigator.userAgent.indexOf(“Firefox”)!=-1 ) window.location.reload(true);

JavaScript string to int convert string değişken türünü sayıya çevirme :

parseInt(‘123.45′)  // 123
parseInt(’77’)      // 77
parseInt(‘077′,10)  // 77
parseInt(’77’,8)    // 63  (= 7 + 7*8)
parseInt(‘077′)     // 63  (= 7 + 7*8)
parseInt(’77’,16)   // 119 (= 7 + 7*16)
parseInt(‘0x77’)    // 119 (= 7 + 7*16)
parseInt(‘099′)     // 0 (9 is not an octal digit)
parseInt(’99’,8)    // 0 or NaN, depending on the platform
parseInt(‘0.1e6’)   // 0
parseInt(‘ZZ’,36)   // 1295 (= 35 + 35*36)

JavaScript setText fonksion

function setHtml(a,b){
x = document.getElementById(a);
if(x) x.innerHTML = b.options[b.selectedIndex].innerHTML;
}
———————
style=”background:URL(images/back_input.gif); background-repeat:repeat-x; background-color:#F1F1F1 ”

JavaScript nesneler kullanıılarak, window ile sayfa yeniden yüklenebilir yani refresh edilebilir.
window.location.reload(true);
======================================================
onClick=”OpenLayer(‘showlog.php?auth=<? echo $auth ?>&token=<? echo rand(1,123)?>’)” style=”cursor: pointer; cursor: hand;”
background-color: #88FFFF url(notes/buttonfon.gif)  top left no-repeat ;
//durum çubuğu

JavaScript nesneler ile window durumu değiştirilmesi: onmouseout=”window.status=’selam’;”
//——————————————————————————————
//öncelikli resimler için
<body onload=”MM_preloadImages(‘images/help_f2.png’,’images/archive_f2.png’)”>
//—————————————————————————————-
//eski browserlar için css import
<style type=”text/css”>
@import url(templates/joomla_admin/css/admin_login.css);
</style>

<a href=”javascript:;” onclick=”dw_scrollObj.scrollTo(‘wn’,540,0); return false”>4</a>
//———————————————————————————————-
// resim üzerine gelince sönük yapma, ayrılınca net tersi
function high(which2){
var theobject=which2;
//highlighting=setInterval(highlightit(theobject),50);
if(which2.style.MozOpacity)
which2.style.MozOpacity=1;
else if (which2.filters)
which2.filters.alpha.opacity=100;
}
function low(which2){
//clearInterval(highlighting);
if(which2.style.MozOpacity)
which2.style.MozOpacity=0.3;
else if (which2.filters)
which2.filters.alpha.opacity=60;
}

//———————————————————————————————————–
//ie7 de javascript (ajax) çalışması için :
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>

JavaScrippt yes no sorgusu:
onclick=”if(window.confirm(‘İletişim bilgilerinizi silmek istediğinizden emin misiniz?’)) window.navigate(‘/address.aspx?action=delete’);”

JavaScript switch case:
switch (red) {
case 1: result = ‘one’; break;
case 2: result = ‘two’; break;
default: result = ‘unknown’

Etiketler: ,

This site uses Akismet to reduce spam. Learn how your comment data is processed.