Pereiti prie turinio

"Registrų konvertorius 0.0.1" by Zeek.


Rekomenduojami pranešimai

Sveiki.

Per porą valandų sukuriau registro keitimo skriptą į viršutinį/apatinį, gal kam bus naudinga.

Skriptas dirba PHP.

 

index.php

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Lietuva.in.ua – Registrų konvertorius 0.0.1</title>
<link rel="StyleSheet" type="text/css" href="http://www.lietuva.in.ua/cms.css">
</head>
<body leftmargin="0" 
     marginheight="0" 
     marginwidth="0" 
     rightmargin="0" 
     bottommargin="0" 
     topmargin="0" >
<table width="100%" 
      border="0" 
      cellspacing="0" 
      cellpadding="0" 
      height="100%">
 <tr class=topmenu>
   <td>
   <div class=logo>Lietuva.in.ua – Registrų konvertorius 0.0.1</div>
   </td>
 </tr>
 <tr valign=top>
   <td height="100%"><br>
   <br>
   <br>
<form action="http://regcon.lietuva.in.ua" method="post">
   <table width="890" border="0" align="center" cellpadding="0" cellspacing="5">
       <tr>
         <td style="text-align: center">Teksto įvedimas:<br>            
         <?php
         echo "<textarea name=\"textarea\" id=\"textarea\" cols=\"120\" rows=\"20\">".htmlspecialchars($_POST['textarea'])."</textarea>";
	  ?>   
         </td>
       </tr>
       <tr>
         <td style="text-align: center">Teksto išvedimas:<br>          
	  <?php
         echo "<textarea name=\"textarea2\" id=\"textarea2\" cols=\"120\" rows=\"20\" readonly>";
	  if (isset($_POST['submit'])) 
	  {
		  $txtarea = mb_strtolower(htmlspecialchars($_POST['textarea']),'utf-8');
		  echo $txtarea;
	  }
	  elseif (isset($_POST['submit2'])) 
	  {
		  $txtareaup = mb_strtoupper(htmlspecialchars($_POST['textarea']),'utf-8');
		  echo $txtareaup;
	  }
	  echo "</textarea>";
	  ?></td>
       </tr>
       <tr>
         <td style="text-align: center">
         <input type="Submit" name="submit" value="patalpinti visą tekstą į apatinį registrą">            
         <input type="Submit" name="submit2" value="PATALPINTI VISĄ TEKSTĄ į VIRŠUTINĮ REGISTRĄ"></td>
       </tr>
   </table>
</form>
     <br>
 <br></td></tr>
<tr class=authors>
 <td><div class=footer>Puslapis sukurtas ir palaikomas Zeek.</div></td></tr>
</table>
</body>
</html>

ir cms.css

body{background-color: #ccc;}
body, table{font-family: Arial, Helvetica, sans-serif; font-size: 12px; overflow-y: scroll;}
a{color: #fff;}
a:hover{color: #fff;}
div.logo{padding-left: 80px; padding-top: 20px; padding-bottom: 20px; font-size: 24px; font-weight: bold;}
table tr.topmenu {color: #fff; background-color: #000; width: 100%;}
table tr.topmenu td {border-bottom-style: solid; border-bottom-width: 2px;}
div.footer{padding-left: 80px; padding-top: 20px; padding-bottom: 20px;}
table tr.authors{color: #fff; background-color: #000; width: 100%;}
table tr.authors td {border-top-style: solid; border-top-width: 2px;}

 

Paveikslėlis:

 

post-40557-0-47254100-1479058615_thumb.png

 

Dėmesis čia:

 

http://www.lietuva.in.ua/cms.css - byla cms.css
http://regcon.lietuva.in.ua - byla index.php ten, kur regcon subdomenas

Redagavo ZTG
Nuoroda į pranešimą
Dalintis kituose puslapiuose

Na ir tokiam funkcionalumui išgauti nereikia net php užtenka javascript, bet jei čia php praktika tai reikėtų sudėlioti kabutes prie html atributų, vengti "inline" stilių ("cellspacing="0" cellpadding="0""), kodo dublikavimo ir vengti html'o php viduje pvz;

 

vietoje

<?php
echo "<textarea name=\"textarea\" id=\"textarea\" cols=\"120\" rows=\"20\">".htmlspecialchars($_POST['textarea'])."</textarea>";
?>  

galėtų būti

<textarea name="textarea" id="textarea" cols="120" rows="20"><?=htmlspecialchars($_POST['textarea'])?></textarea>  

 

Beje mano patobulintas variantas su javascript ;) (keičiau tik funkcionalumą), gal ką naudingo atrasi.

 

<html>
  <head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
     <title>Lietuva.in.ua – Registrų konvertorius 0.0.1</title>
     <link rel="StyleSheet" type="text/css" href="http://www.lietuva.in.ua/cms.css">
  </head>
  <body leftmargin="0" 
     marginheight="0" 
     marginwidth="0" 
     rightmargin="0" 
     bottommargin="0" 
     topmargin="0" >
     <table width="100%" 
        border="0" 
        cellspacing="0" 
        cellpadding="0" 
        height="100%">
        <tr class=topmenu>
           <td>
              <div class=logo>Lietuva.in.ua – Registrų konvertorius 0.0.1</div>
           </td>
        </tr>
        <tr valign=top>
           <td height="100%">
              <br>
              <br>
              <br>
              <form action="http://regcon.lietuva.in.ua" method="post">
                 <table width="890" border="0" align="center" cellpadding="0" cellspacing="5">
                    <tr>
                       <td style="text-align: center">Tekstas:<br>            
                          <textarea id="input" cols="120" rows="20"></textarea>
                       </td>
                    </tr>
                    <tr>
                       <td style="text-align: center">
                          <input type="checkbox" id="case"> Viršutinis registras
                       </td>
                    </tr>
                 </table>
              </form>
              <br>
              <br>
           </td>
        </tr>
        <tr class=authors>
           <td>
              <div class=footer>Puslapis sukurtas ir palaikomas Zeek.</div>
           </td>
        </tr>
     </table>
     <script>
         var input = document.getElementById('input');
         var caseElement = document.getElementById('case');
         input.addEventListener('input', () => input.value = caseElement.checked ? input.value.toUpperCase() : input.value.toLowerCase());
         caseElement.addEventListener('input', () => input.dispatchEvent(new Event('input')));
  </script>
  </body>
</html>

Redagavo liuxx
Nuoroda į pranešimą
Dalintis kituose puslapiuose
  • po 5 metų...

Prisijunkite prie diskusijos

Jūs galite rašyti dabar, o registruotis vėliau. Jeigu turite paskyrą, prisijunkite dabar, kad rašytumėte iš savo paskyros.

Svečias
Parašykite atsakymą...

×   Įdėta kaip raiškusis tekstas.   Atkurti formatavimą

  Only 75 emoji are allowed.

×   Nuorodos turinys įdėtas automatiškai.   Rodyti kaip įprastą nuorodą

×   Jūsų anksčiau įrašytas turinys buvo atkurtas.   Išvalyti redaktorių

×   You cannot paste images directly. Upload or insert images from URL.

Įkraunama...
  • Dabar naršo   0 narių

    Nei vienas registruotas narys šiuo metu nežiūri šio puslapio.

×
×
  • Pasirinkite naujai kuriamo turinio tipą...