URL Decoder/Encoder - -

博客展示了一个URL编码与解码工具的实现。通过HTML创建页面,包含文本输入框和编码、解码按钮。使用JavaScript编写了encode和decode函数,分别实现对输入字符串的编码和解码操作,方便用户对URL进行处理。

出处:http://www.z4.cn/bbs/showthread.php?threadid=2939

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html>
<head>
<title>URL Decoder/Encoder</title>
<style type="text/css">
<!--
body {background: white; color: black;}
form {margin: 0;}
h1 {font-family: Arial, sans-serif; line-height: 0.85em; border-bottom: 2px solid; margin-bottom: 0.33em; padding-bottom: 0;}
textarea {background: #EEF;}
#footer {border-top: 1px solid #000; color: #999; font: italic 75% sans-serif;}
#footer p {margin: 0 0 1em 0;}
#footer img {float: right; margin: 0 0 0.5em 2em;}
-->
</style>
<script type="text/javascript">
function encode() {
 var obj = document.getElementById('dencoder');
 var unencoded = obj.value;
 obj.value = escape(unencoded);
}
function decode() {
 var obj = document.getElementById('dencoder');
 var encoded = obj.value;
 obj.value = unescape(encoded.replace(//+/g,  " "));
}
</script>
</head>
<body><form onsubmit="return false;"><h1>URL Decoder/Encoder</h1>
<textarea cols="80" rows="20" id="dencoder"></textarea>
<div><input type="button" onclick="decode()" value="Decode">
<input type="button" onclick="encode()" value="Encode"></div>
<ul><li>Input a string of text and encode or decode it as you like.</li>
<li>Handy for turning encoded JavaScript URLs from complete gibberish into readable gibberish.</li>
<li>If you'd like to have the URL Decoder/Encoder for offline use, just view source and save to your hard drive.</li></ul></form>
</body>
</html>

URL Decoder/Encoder
Not nearly as cool or flashy as the Color Blender, it's still useful for situations where a massively long encoded URL needs to be decoded. I wrote this one for me, but figured I'd throw it up here for anyone else who needed it.
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值