Advertisement
Guest User

Untitled

a guest
Oct 12th, 2012
358
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     function zapiszNowyTitle() { // function to save given title
  2.         var el = document.getElementById('input_givenToAdd').value;
  3.        
  4.         if ( el !== '' ) {
  5.        
  6.             var xmlhttp;
  7.            
  8.             if (window.XMLHttpRequest) {
  9.                 xmlhttp=new XMLHttpRequest();
  10.             } else {
  11.                 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  12.             }
  13.        
  14.             xmlhttp.onreadystatechange=function() {
  15.                 if (xmlhttp.readyState==4 && xmlhttp.status==200) {
  16.                     document.getElementById('dodawarka').outerHTML = '<li><span class="istniejacyTitle">' + xmlhttp.responseText + '</span></li>' + "\r\n" + '<li><a id="niekliknieteDodawanie" href="#">Dodaj nową podstronę</a></li>' + "\r\n";
  17.                     przyciskPokazujacyInputBox();
  18.                     przyciskRozpoczynajacyEdycje();
  19.                 }
  20.             };
  21.            
  22.             el = encodeURIComponent(el);
  23.             el = el.replace(/\#/g, '&#35;'); // replaces all '#'
  24.             el = el.replace(/\\/g, '&#92;'); // replaces all '\'
  25.             alert(el);
  26.             xmlhttp.open("GET","process_add_article.php?&title=" + (el),true);
  27.             xmlhttp.send();    
  28.  
  29.         } else {
  30.        
  31.             alert('Proszę podać nazwę nowej podstrony!');
  32.            
  33.         }
  34.     }
  35.    
  36.     function rozpocznijEdycjePodstrony(el) { // function to send edited map info to DB
  37.        
  38.         el = encodeURIComponent(el);
  39.         el = el.replace(/\#/g, '&#35;'); // replaces all '#'
  40.         el = el.replace(/\\/g, '\'); // replaces all '\'
  41.         window.location.href = "process_article_selection.php?&id=" + (el);
  42.            
  43.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement