asmodeus94

usunNumPas

Dec 1st, 2012
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.67 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" />
  5. <script type="text/javascript">
  6. d=document;
  7. function usun(co){
  8.     elem=d.getElementById(co);
  9. if(elem.value!=""){
  10. for(i=1;i<=elem.value.length/5;i++){
  11.     if(i!=1) elem.value=d.getElementById(co).value.replace(i+". ","\n");else elem.value=elem.value.replace(i+". ","");
  12. }elem.value=elem.value.replace(/\n\n/g,"");}
  13. }
  14. function usunKomen(co){
  15.     elem=d.getElementById(co);
  16.     for(i=1;i<=elem.value.length/5;i++){
  17.         if(elem.value.indexOf("/*")!=-1){
  18.             pocz=elem.value.indexOf("/*");
  19.             kon=elem.value.indexOf("*/");
  20.             wycinek=elem.value.slice(pocz,kon+2);
  21.             elem.value=elem.value.replace(wycinek,"");
  22.         }
  23.     }
  24. }
  25. function czysc(co){
  26.     elem=d.getElementById(co);
  27.     elem.value="";
  28. }
  29. </script>
  30. <style type="text/css">
  31. #main{
  32. margin:0 auto;
  33. width:500px;
  34. }
  35. #buttons{
  36. width:500px;
  37. margin:0 auto;
  38. text-align:center;
  39. }
  40. </style>
  41. <title>Usuwanie liczb</title>
  42. </head>
  43. <body>
  44. <div id="main"><textarea id="txt" style="width:500px;height:200px;""></textarea>
  45. <div id="buttons"><input id="usL" type="button" value="Usuń liczby"/><input id="usK" type="button" value="Usuń komentarze" onclick="usunKomen('txt');"/><input id="clP" type="button" value="Czyœść pole" onclick="czysc('txt');"/></div></div>
  46. <script type="text/javascript">
  47. d.getElementById('usL').onclick=function(){usun('txt');}
  48. d.getElementById('usK').onclick=function(){usunKomen('txt');}
  49. d.getElementById('clP').onclick=function(){czysc('txt');}
  50. </script>
  51. </body>
  52. </html>
Advertisement
Add Comment
Please, Sign In to add comment