Ceviz Forum

Geri Dön   Ceviz Forum > Programlama > Javascript / DHTML / Ajax

Cevapla
 
LinkBack Seçenekler
Eski 20/12/2006, 09:28   #1 (permalink)
xam
<? echo $xam; ?>
 
xam Adlı Üyenin Profil Grafiği
 
Üyelik Tarihi: 03/2006
Mesaj: 977
Varsayılan Fonksiyon kisaltmasi.

Selamlar,

ajax bilgim cok az ama kendi sistemimde calisabilecek bir kod hazirladim ve herhangi bir problem yok, sormak istedigim her biri icin ayri isimler fonksiyon yerine kisaltma yapabilirmiyiz? birde herhangi bir guvenlik acigi varmi..

PHP Kodu:
var http_request false;
   function 
makePOSTRequest(urlparameters) {
      
document.getElementById('loading').style.visibility "visible";
      
http_request false;
      if (
window.XMLHttpRequest) { // Mozilla, Safari,...
         
http_request = new XMLHttpRequest();
         if (
http_request.overrideMimeType) {
             
// set type accordingly to anticipated content type
            //http_request.overrideMimeType('text/xml');
            
http_request.overrideMimeType('text/html');
         }
      } else if (
window.ActiveXObject) { // IE
         
try {
            
http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (
e) {
            try {
               
http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (
e) {}
         }
      }
      if (!
http_request) {
         
alert('Cannot create XMLHTTP instance');
         return 
false;
      }
      
      
http_request.onreadystatechange alertContents;
      
http_request.open('POST'urltrue);
      
http_request.setRequestHeader("Content-type""application/x-www-form-urlencoded");
      
http_request.setRequestHeader("Content-length"parameters.length);
      
http_request.setRequestHeader("Connection""close");
      
http_request.send(parameters);
   }

   function 
alertContents() {
      if (
http_request.readyState == 4) {
         if (
http_request.status == 200) {
            
//alert(http_request.responseText);
            
result http_request.responseText;
            
document.getElementById('preview').innerHTML result
            
document.getElementById('loading').style.visibility "hidden";
         } else {
            
alert('There was a problem with the request. Please report this to administrator.');
         }
      }
   }
  
   function 
get(obj) {
      var 
poststr "msg=" encodeURIdocument.getElementById(obj).value );
      
makePOSTRequest('/preview.php'poststr);
   }

   
   function 
makeArequestR(urlparameters) {
      
document.getElementById('loading').style.visibility "visible";
      
http_request false;
      if (
window.XMLHttpRequest) { // Mozilla, Safari,...
         
http_request = new XMLHttpRequest();
         if (
http_request.overrideMimeType) {
             
// set type accordingly to anticipated content type
            //http_request.overrideMimeType('text/xml');
            
http_request.overrideMimeType('text/html');
         }
      } else if (
window.ActiveXObject) { // IE
         
try {
            
http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (
e) {
            try {
               
http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (
e) {}
         }
      }
      if (!
http_request) {
         
alert('Cannot create XMLHTTP instance');
         return 
false;
      }
      
      
http_request.onreadystatechange makeArequestAlertContentsR;
      
http_request.open('POST'urltrue);
      
http_request.setRequestHeader("Content-type""application/x-www-form-urlencoded");
      
http_request.setRequestHeader("Content-length"parameters.length);
      
http_request.setRequestHeader("Connection""close");
      
http_request.send(parameters);
   }

   function 
makeArequestAlertContentsR() {
      if (
http_request.readyState == 4) {
         if (
http_request.status == 200) {
            
//alert(http_request.responseText);
            
result http_request.responseText;
            
document.getElementById('preview').innerHTML result
            
document.getElementById('loading').style.visibility "hidden";            
         } else {
            
alert('There was a problem with the request. Please report this to administrator.');
         }
      }
   }
  
   function 
rate(obj,filename) {    
      var 
poststr "id=" encodeURIdocument.getElementById("torrentid").value ) +
                    
"&rating=" encodeURIdocument.getElementById("rating").value );
      
makeArequestR(filenamepoststr);      
   }
    
    function 
makeArequestT(urlparameters) {
      
document.getElementById('loadingt').style.visibility "visible";
      
http_request false;
      if (
window.XMLHttpRequest) { // Mozilla, Safari,...
         
http_request = new XMLHttpRequest();
         if (
http_request.overrideMimeType) {
             
// set type accordingly to anticipated content type
            //http_request.overrideMimeType('text/xml');
            
http_request.overrideMimeType('text/html');
         }
      } else if (
window.ActiveXObject) { // IE
         
try {
            
http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (
e) {
            try {
               
http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (
e) {}
         }
      }
      if (!
http_request) {
         
alert('Cannot create XMLHTTP instance');
         return 
false;
      }
      
      
http_request.onreadystatechange makeArequestAlertContentsT;
      
http_request.open('POST'urltrue);
      
http_request.setRequestHeader("Content-type""application/x-www-form-urlencoded");
      
http_request.setRequestHeader("Content-length"parameters.length);
      
http_request.setRequestHeader("Connection""close");
      
http_request.send(parameters);
   }

   function 
makeArequestAlertContentsT() {
      if (
http_request.readyState == 4) {
         if (
http_request.status == 200) {
            
//alert(http_request.responseText);
            
result http_request.responseText;
            
document.getElementById('previewt').innerHTML result
            
document.getElementById('loadingt').style.visibility "hidden";            
         } else {
            
alert('There was a problem with the request. Please report this to administrator.');
         }
      }
   }

   function 
thanks(obj,filename) {    
      var 
poststr "id=" encodeURIdocument.getElementById("thankstorrentid").value );
      
makeArequestT(filenamepoststr);      
   } 
su sekilde kullaniyorum

puanlama icin
PHP Kodu:
<input type="button\" class=\"btn\" name=\"button\" value=\"Rate\" onclick=\"javascript:rate(this.parentNode,'takerate.php');\"> <img id=\"loading\" style=\" visibility: hidden\" src=\"$BASEURL/pic/ajax-loader.gif\"> <span style=\"color:red\" name=\"preview\" id=\"preview\" align=\"left\"></span> 
tesekkur etmek icin

PHP Kodu:
<p align=left><form action="takethanks.php\" method=\"post\">
    <input type=\"hidden\" name=\"torrentid\" id=\"thankstorrentid\" value=\"$torrentid\">
<input type=\"button\" class=\"btn\" name=\"button\" value=\"Say thanks!\" onclick=\"javascript:thanks(this.parentNode,'takethanks.php');\"> <img id=\"loadingt\" style=\" visibility: hidden\" src=\"$BASEURL/pic/ajax-loader.gif\"> <span style=\"color:red\" name=\"preview\" id=\"previewt\" align=\"left\"></span>
</form></p> 
__________________
Cevizi kIr, icinden cikani ye
xam hatta değil   Alıntı Yaparak Yanıtla
Cevapla

Bookmarks

Seçenekler

Mesaj Yazma Hakları
Yeni mesajgöndermezsiniz
Cevap yazamazsınız
Dosya ekleyemezsiniz
Mesajınızı düzenleyemezsiniz

BB code is Açık
[IMG] kodu Açık
HTML kodu Kapalı
Trackbacks are Açık
Pingbacks are Açık
Refbacks are Açık

Benzer Konular
Konu Konuyu açana göre Forum Cevap En Son Mesaj
fonksiyon mehmet_sait PHP 3 19/11/2006 04:37
fonksiyon içinde, fonksiyon dışında ki bir değişkene değer atamak yesilce PHP 4 19/08/2006 02:53
fonksiyon sadroalin PHP 2 11/04/2005 17:40
Üye Fonksiyon Arkantos C / C++ 7 23/12/2004 03:01
fonksiyon Pyramid PHP 4 21/11/2004 22:00


Forum saati Türkiye saatine göredir. GMT +3. Şu anda saat 05:56.

Reklamlar & Desteklenenler
Hassas Valf | Hassas Kaplama | Antalyamız | Gazete | Ticari Bilişim | Hakan Müştak | Rüya Tabirleri | Kadın | Hastalıklar | Cepte msn ve e-posta | Webmaster | Antalya Aupair | Turkish Property Antalya | Forum | Chat | Perde | Adsl | Araba | bolindir.com | guncelle.com | livescore | Web Tasarım | evden eve nakliyat | forum | evden eve | sohbet | Resimcim| Kalifiye İnsan Kaynakları | Web Tasarım | Oyun | Yusuf KOÇ | Akın Yorulmaz | şiir | UFO | Web Tasarım | Oyunlar | Canlı Tv |


Forum Yazılımı: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright ©2001 - 2008, Ceviz.net