URL Encode & URL Decode tool

HTML code of URL Encode & URL Decode tool

<h1>URL Encode</h1>
<textarea rows=6 cols=50 id=”encodeTxt”></textarea><br/><br/>
<button type=”button” onclick=”urlencodeTxt()”> ENCODE </button><br/><br/>
<textarea rows=6 cols=50 id=”encodeResult” placeholder=”Result goes here”></textarea>
<hr/>
<h1>URL Decode</h1>
<textarea rows=6 cols=50 id=”decodeTxt”></textarea><br/><br/>
<button type=”button” onclick=”urldecodeTxt()”> DECODE </button><br/><br/>
<textarea rows=6 cols=50 id=”decodeResult” placeholder=”Result goes here”></textarea>

<br/></br/>

Java Script code:

function urlencodeTxt() {
var urlEncodeTxt = document.getElementById(“encodeTxt”).value;
var resEncode = encodeURIComponent(urlEncodeTxt);
document.getElementById(“encodeResult”).value = resEncode;
}

function urldecodeTxt() {
var urlDecodeTxt = document.getElementById(“decodeTxt”).value;
var resDecode = decodeURIComponent(urlDecodeTxt);
document.getElementById(“decodeResult”).value = resDecode;
}

 

Leave a Comment

Exit mobile version