SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    do righteous deeds
    Join Date
    Aug 2006
    Location
    Türkiye Turkey تركيى
    Posts
    266
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    To write "87" in bilgi.txt

    yolla.htm
    Code:
      
    <html>
    <head>
    <meta charset="utf-8">
    <script type="text/javascript">
    
    var nesne ;
    if(navigator.appName.search('Microsoft')>-1) { nesne = new ActiveXObject('MSXML2.XMLHTTP'); }
    else { nesne = new XMLHttpRequest(); }
    
    function yolla() {
    nesne.open('get', 'bilgi.txt', true); 
    nesne.onreadystatechange= cevap;
    nesne.send(null);
    }
    
    function cevap() {
    if(nesne.readyState==4) {
    var el = document.getElementById('bilgi');
    el.innerHTML = nesne.responseText;
    }
    }
    
    </script>
    </head>
    <body>
    <input type="button" value="bilgi.txt dosyadaki yazıyı buraya al"  onclick="yolla()">
    
    <div id="bilgi"></div>
    
    </body>
    </html>
    bilgi.txt
    Code:
     
    5
    I clicked the button, it is writing "5" in div

    The code I wanted: I clicked the button, it is writing "87" in bilgi.txt
    How can I do this?
    The Time Through Ages
    1. By the Time, 2. Verily Man is in loss, 3. Except such as have Faith, and do righteous deeds, and (join together) in the mutual enjoining of Truth, and of Patience and Constancy.

  2. #2
    do righteous deeds
    Join Date
    Aug 2006
    Location
    Türkiye Turkey تركيى
    Posts
    266
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    using jquery
    I clicked <a... , it is writing 5 in div
    Code:
      
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>jQuery ve AJAX işlemleri</title>
    <script type="text/javascript" src="http://ajax.microsoft.com/ajax/jQuery/jquery-1.3.2.min.js"></script>
    <script type="text/javascript">
    
    // http://www.eburhan.com/jquery-ve-ajax-islemleri/
    // http://www.eburhan.com/wp-content/ekler/91/ornek_1A.php
    
    	$(document).ready(function(){
    		$('a').click( sonucAl );
    	});
    	
    	function sonucAl()
    	{
    		 $('#sonuc').html('hesaplanıyor...');
    		 
    		 $.ajax({
    		   type: 'GET',
    		   url: 'bilgi.txt',
    		   data: 'url=""',	   
    		   success: function(sonuc) {
    			 	$('#sonuc').html(sonuc);
    		   }
    		 });
    
    		return false;
    	}
    </script>
    <style type="text/css">
    	a{
    		text-decoration:none;
    		font: normal 13px "Trebuchet MS";
    		color: #333
    	}
    	a:hover { color:#FF0000 }
    
    	div { 
    		border: 1px solid #CCCCCC; 
    		background:#FFFFCC;
    		color:#666;
    		font: normal 13px "Trebuchet MS";
    		width: 350px;
    		padding: 10px
    	}
    </style>
    </head>
    <body>
    
    <a href="http://www.google.com/search?hl=en&q=link%3Awww.eburhan.com">eburhan.com'un backlink sayısını hesaplamak için tıklayın...</a>
    <br />
    
    <br />
    
    <div id="sonuc">sonuç buradan gözükecek...</div>
    
    </body>
    </html>
    The code I wanted: I clicked the button, it is writing a text in bilgi.txt
    The Time Through Ages
    1. By the Time, 2. Verily Man is in loss, 3. Except such as have Faith, and do righteous deeds, and (join together) in the mutual enjoining of Truth, and of Patience and Constancy.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •