JavaScript URL kodlama-kod çözme kodu canlı-çevrimiçi kullanımı örneği (JavaScript URL encode-decode code live-online usage example)

Javascript HTML URL kodlama(encoding) ve kodu çözme(decoding) kodu kullanımı örneği




	url encode decode encodeURIComponent decodeURIComponent
	

	




	
	
	
	


	
decoded :
encoded :
decodedComp :
encodedComp :
Canlı kod bloğu kodları: [code language=”html”] <!DOCTYPE html> <html> <head> <title>url encode decode encodeURIComponent decodeURIComponent</title> <meta http-equiv=’Content-Type’ content=’text/html;charset=UTF-8′ /> <script type="text/javascript" id="javascriptEncodeDecodeScript" language="javascript"> function doOp() { var orjURI = document.getElementById("uriInp").value; document.getElementById("decoded").innerHTML = getDecoded(orjURI); document.getElementById("encoded").innerHTML = getEncoded(orjURI); document.getElementById("decodedComp").innerHTML = getDecodedComp(orjURI); document.getElementById("encodedComp").innerHTML = getEncodedComp(orjURI); } //get decoded function getDecoded(url) { try{ var deurl= decodeURI(url); } catch (err) { console.log("stdu-getDecoded:" + url + "—" + err); return "invalid-geçersiz URL"; } return deurl; } //get encoded function getEncoded(url) { try{ var enurl= encodeURI(url); } catch (err) { console.log("stdu-getEncoded:" + url + "—" + err); return "invalid-geçersiz URL"; } return enurl; } //get decodedComp function getDecodedComp(url) { try{ var deCompurl = decodeURIComponent(url); } catch (err) { console.log("stdu-decodedComp:" + url + "—" + err); return "invalid-geçersiz URL"; } return deCompurl; } //get encodedComp function getEncodedComp(url) { try{ var enCompurl = encodeURIComponent(url); } catch (err) { console.log("stdu-encodedComp:" + url + "—" + err); return "invalid-geçersiz URL"; } return enCompurl; } </script> </head> <body> <!– –> <textarea id="uriInp" placeholder="URL" style="resize:none;" rows="3" cols="75"></textarea> <!– –> <input type="button" id="doOpBtn" value="decode-encode" onclick="doOp();"/> <br> <b>decoded :</b><label id="decoded"></label> <br> <b>encoded :</b><label id="encoded"></label> <br> <b>decodedComp :</b><label id="decodedComp"></label> <br> <b>encodedComp :</b><label id="encodedComp"></label> <br> <footer> <b> <address> <a href="http://www.yazilimcity.net">www.yazilimcity.net</a> </address> </b> </footer> </body> </html> [/code]]]>

Leave a Reply

Your email address will not be published. Required fields are marked *