Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
10-19-2018, 05:23 AM | #1 |
Confirmed User
Industry Role:
Join Date: Jul 2012
Posts: 2,925
|
javascript question, textbox space and carriage return added
javascript question, space and carriage return added to the output text.
I am working on a chrome extension that encodes text. But a space and carriage return are being added to the output. Anybody know why? example http://nicecamgirls.com/popup.htm |
10-19-2018, 05:23 AM | #2 |
Confirmed User
Industry Role:
Join Date: Jul 2012
Posts: 2,925
|
my code
Code:
<body> <script> function encodeFunction() { var x; x = document.getElementById("inputtext").value; if(document.getElementById('urlEncodecheck').checked){ var encodex; encodex = encodeURIComponent(x); } if(document.getElementById('HTMLEncodecheck').checked){ var encodex; encodex = x.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"'); } if(document.getElementById('hexencodecheck').checked){ var s = unescape(encodeURIComponent(x)) var encodex = '' for (var i = 0; i < s.length; i++) { encodex += "%" + s.charCodeAt(i).toString(16) }} if(document.getElementById('base64Encodecheck').checked){ var encodex = ''; encodex = window.btoa(x); } document.getElementById("outputttext").value = encodex; } </script> <h1>Encode</h1> <form action=""> <input type="radio" name="encodetype" id="urlEncodecheck" checked="checked" oninput="encodeFunction()">Url<br> <input type="radio" name="encodetype" id="base64Encodecheck" oninput="encodeFunction()">Base64<br> <input type="radio" name="encodetype" id="HTMLEncodecheck" oninput="encodeFunction()">HTML<br> <input type="radio" name="encodetype" id="hexencodecheck" oninput="encodeFunction()">Hex <h2>Input</h2> <textarea id="inputtext" rows="4" cols="50" oninput="encodeFunction()" autofocus> </textarea> <h2>Output</h2> <textarea id="outputttext" rows="4" cols="50" readonly> </textarea> </body> |
10-19-2018, 07:35 AM | #3 |
l8r
Industry Role:
Join Date: Oct 2002
Posts: 13,512
|
The extra shit is coming from your textarea. The way you coded the textarea puts spaces and the line feed in there. Just put the textarea close right up against the open and the extra shit should go away.
<textarea id="inputtext" rows="4" cols="50" oninput="encodeFunction()" autofocus></textarea> . |
10-19-2018, 07:41 AM | #4 |
Too lazy to wipe my ass
Industry Role:
Join Date: Aug 2002
Location: A Public Bathroom
Posts: 37,869
|
i%20like%20poo%20%0A
aSBsaWtlIHBvbyAK i like poo %69%20%6c%69%6b%65%20%70%6f%6f%20%a |
10-19-2018, 08:26 AM | #5 | |
l8r
Industry Role:
Join Date: Oct 2002
Posts: 13,512
|
Quote:
BTW, if any one cares. "extra shit" is the technical term for that extra shit . |
|
10-19-2018, 08:41 AM | #6 | |
Confirmed User
Industry Role:
Join Date: Jul 2012
Posts: 2,925
|
Quote:
|
|
10-19-2018, 08:48 PM | #7 |
l8r
Industry Role:
Join Date: Oct 2002
Posts: 13,512
|
|