blog.area23.at - a simple url encoder/decoder

 a simple url encoder/decoder
 http://blog.area23.at

Labels

Wirtschaft (120) Österreich (92) Pressefreiheit (65) IT (47) Staatsschulden (30) code (25) EZB (19) Pensionssystem (13) France (1) music (1)

2013-01-16

a simple url encoder/decoder in javascript

<script type="text/javascript" language="javascript">
    function urlencode(s) {
        if (s == null || s.value == null || s.value == '') {
            alert("Url to encode is null or empty!");
            return ;
        } 
        var uri = encodeURIComponent(s.value)
        document.getElementById('output').value = uri;
    }              
    function urldecode(s) {        
        if (s == null || s.value == null || s.value == '') {
            alert("Url to decode is null or empty!");
            return ;
        }   
        var uri = decodeURIComponent(s.value)
        document.getElementById('output').value = uri;
    }
</script>

<form action="" id="urlform">
  <table cellspacing="1" cellpadding="1">
    <tr>
      <td>
        <input type="text" id="url" name="url" size="64" maxlength="256"
          value="http%3A%2F%2Fblog.area23.at%2F" />
      </td><td>
        <input type="button" id="deocde" name="deocde" value="deocde"
          onclick="urldecode(document.getElementById('url'))" />
      </td><td align="right">
        <input type="button" id="encode" name="encode" value="encode"
          onclick="urlencode(document.getElementById('url'))" />
      </td><td align="right">
        &nbsp;a simple url encoder/decoder
      </td>   
    </tr><tr>
      <td colspan="3">
        <input type="text" id="output" name="output" size="90" maxlength="256" readonly="readonly" />
      </td><td align="right">
        &nbsp;<a href="http://blog.area23.at">http://blog.area23.at</a>
      </td>
    </tr>   
  </table>
</form>    

Keine Kommentare:

Kommentar veröffentlichen