Make A Basic Encoder That Can Encode And Decode Text?
Jul 27, 2011How could a make a basic javascript encoder that can encode and decode text?
(i just would want some tips on how to start)
How could a make a basic javascript encoder that can encode and decode text?
(i just would want some tips on how to start)
How would I modify this form to encode *all* the characters in the 'source' textarea to the
'%xx' format & place result code into the 'output' textarea?
I could have sworn I saw a command that allows Javascripts to use the browser's native base64 encode/decode but I must be Googling for the wrong terms. Do most browsers expose these converters to javascripts's there a way to use these converters?
View 1 Replies View RelatedI want to encode and decode a javascript file in which many javascript function running.
i fount lot of function decode and encode but not worrkking well .
I am building a client-side and server-side solution and want to use JSON through Ajax in both directions. I have ASP or JavaScript server-side, though Microsoft's support of server side JavaScript seems nil, so I am reluctantly conceeding to use ASP. I'd appreciate suggestions on available solutions to encode/decode JSON on the server-side (ASP or JavaScript). I don't plan to load jQuery server-side so that rules out plug-ins. I'd also like to know what is the latest client-side encode/decode for JSON. Is it built in jQuery or a plug-in? In both server and client, decoding JSON securely is key, so using eval () to decode is out.
View 1 Replies View RelatedI'm reusing a basic text sizer script and want it to focus on an element of my choice. What is fundamentally wrong with this code? The only issue is that document.getElementById(container); comes back 'not defined' in firebug, and the script doesn't make it to the alert(c) call.
The var container is passed in as 'caseDetail'. Which is a div element generated dynamically with PHP, and has the id "caseDetail". I've loaded the script dynamically inside this element itself (shame on me).
var min=8;
var max=18;
function increaseFontSize(container) {
var c = document.getElementById(container);
[Code]....
when the user types a FIRST NAME into the first name textbox this should update the paxname with the value and a space.when the user types a LAST NAME into the last name textbox this should update the paxname with the value therefore at the end of the process the paxname will have the full name of the person in order with spaces in between. also i would like the first name and last name values to be changed to proper case ie John Smith once placed into paxname the update process does not have to be instantaneous, it can perhaps update the paxname textbox when the focus is gone from the field in question, dont mind how it works as long as it updates.
View 6 Replies View RelatedI am trying to test out a basic xhtml form using radio buttons and text boxes. I want a user to select one of the radio buttons and have the focus change to the relevant text box where they can enter in the title of their choice.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
[Code]....
My first day with jquery, and I've just been playing around a little but have run in to a problem in Firefox.
I've set up a basic form with a name and a button (not submit) and one text field.
All it does right now is open an alert box when the button is clicked. That's fair enough. However, in Firefox, if I have the text field selected and hit enter, it doesn't press the button.
How would I go about making sure the enter key presses the button? I'd like to avoid using onclick and a method in the form if possible. My aim eventually is to post data and return it without a page refresh instead of create an alert box.
<html>
I think my last question was not clear, so people gave me the reverse
answer.
I want to put a string in an html file, and human eyes or robots will not be
able to read it.
For example I want to turn this one
<a href="#" onclick="this.href='http://www.google.com'">click here</a>
into
<a href="#" onclick="this.href=' encoded of h encoded of t encoded of t
encoded of p encoded of :
encoded of : encoded of / '">click here</a>
I prefer bit OR, the ^ opertaion, but ASCII is fine with me, like %40%xx%xx
This plus disable right click will make search engines and view source
difficult but still possible to know where it is linked too,
Page where I'm redirecting user after 5 seconds to another page. This part of the script seems to work fine and redirects to the URL I want. However, the issue comes when I try and add parameters onto the URL. The redirect will stop working. I believe it's a formatting issue, as I've used the code in a different application. [code]...
View 13 Replies View RelatedI got a String — how could I decode back into HTML which is
using Javascript ?
Does anybody know to decode this code...
View 2 Replies View RelatedI have a pop up window, that window needs to refresh the parent window when opened, I'm doing the following:
window.opener.location.href(window.opener.location .href);
problem I'm having is that the parent url has a # sign in it, like:
http://localhost/mysite/me.html#01
i need the #01 to stay in the url after the refresh, anyway to do
this? i tried using escape(window.opener.location.href) but that
didn't work, as it escaped everything including the :// in http://
i also tried:
window.opener.location.href(window.opener.location .protocol + "//" +
window.opener.location.hostname + window.opener.location.pathname);
problem with that was i lost the #01 in the url, pathname didn't
include it.
I've recently come upon an odd Javascript (and/or browser) behavior, and after hunting around the Web I still can't seem to find an answer.
Specifically, I have noticed that the Javascript encode() function behaves differently if a codepage has been set.
<script>
document.write(escape('Ôèëìè'));
(note: that should be five accented characters)
</script>
Produces: %D4%E8%EB%EC%E8
But setting the codepage to Windows-1251:
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;
charset=Windows-1251">
<script>
document.write(escape('Ôèëìè'));
</script>
Produces: %u0424%u0438%u043B%u043C%u0438
Personally, I wouldn't expect the Javascript encode() function to change its behavior if the codepage has been changed.
Might you know of any resources that can help me better understand what's happening there?
Code...I need to get read of the stupid advertisement it produces.
View 3 Replies View RelatedWith decoding an input box value and passing that into the url.
Basically i wrote a function that decodes a url. for example if i enter t05:34:23-79-79.003z.444z, i want it to stay like that when it goes into the url. if you use internet explorer, entering that input becomes... t05%3A34%3A23-79-79.003z.444z. on google chrome, it stays as t05:34:23-79-79.003z.444z but i need this to work on internet explorer.
CODE:
Do i need to encode my data send through AJAX post? Ex.
var name = $("input#name").val();
var dataString = 'name='+ name;
///////////////////////////////////////////////
$.ajax({
[Code]....
I have this JSON file that does the encoding from the states database.I want to extract it out using jquery and populate the select dropdown box. the json file is being encoded in this way:
[
{"State":{"name":"AUSTRALIA CAPITAL TERRITORY"}},
{"State":{"name":"NEW SOUTH WALES"}},
[code]....
I am getting following Json output from PHP file code...
how can I decode/get these Json values in Jquery.
I am using following Javascript code to get Json values [in Javascript]code...
I'm trying to use a script for my website. But the script is obfuscated and in english - I need the words in portuguese; besides, the font is the always default Times New Roman, the script uses the <h3> old tags, etc... How to decode some of the files, so I can alter these aspects?
View 2 Replies View RelatedI am new to javascript, and am having an issue, which I'm sure is elementary.. I found a script for expandable content, it suffices fine. As it stands, the script toggles images onclick. For example, whence the menu is collapsed, it displays "plus.gif" next to it, and when the menu is expanded, it displays "minus.gif" next to it.
Basically, what I would like to know is, thus: how would I change it to display text icons next to it? For example, in place of "plus.gif" I should like it to display "+" as actual text. I've dredged a number of places, however, I've found nothing. Furthermore, I cannot figure out how to do it.
I have a few input and textarea fields and when the submit button is pressed, I use $.ajax to send the data to a PHP script, which in turn, simply prints the data, which in turn is displayed in an alert msg box back in my callback. (The script will eventually load the data into a database but for simplification this is all it does for now).
The only problem, is that the $.ajax encodes/escapes special characters automatically and I can't figure out how to decode/unescape them to make them usable again. Here is the javascript (I simplified it to make it easy to understand):
$.ajax(
Here is my php ajax script (super simple)
So anyways, everything appears to work fine. I enter some info into 'myTextArea', and press submit. The script sends it to the PHP script, which it turn returns the same value and the javascript puts it in a message box.
So the problem specifically is if I send special characters like any of the quotes ' " (single or double quotes). Lets say my text area had this text in it: It's My "Birthday"
$.ajax sends the following data: It's My "Birthday"
So how do I unescape this? Ya, I could simply replace all backslashes, but I assume there are other characters it may escape in special ways I'm not sure about. What is the proper way to do it?
The only possible way I could figure out to do this was to use escape($('#myTextArea').val())
So the data gets sent as: It%27s%20My%20%22Birthday%22
And then use the PHP command "urldecode" on the other end. It turns out correct that way. However, that doesn't seem like the proper way to do it. Javascript 'escape' command was meant for escaping characters for sending GET variables and for sending formatted URLs. Not for text and input forms. Is there a better/more proper way?
While saving the html code, I accidentally saved my code as encrypted code.I don't remember what did I do.More importantly, Now I dont' now decrypt it.
View 1 Replies View RelatedI am working on creating a JSON feed that is later being used with Arshaw's fullCalendar, which I am integrating into Expression Engine CMS. Currently I am doing the following, and all works well.
<?php $ms_title_array = array(); ?>
<?php $ms_start_date = array(); ?>
<?php $ms_due_date = array(); ?>
[code]....
What I am curious about is I am trying to create another array set that is pulling new information from a different source. Is it possible to use the json_encode(); method to encode two separate variables?If not, is there a way I can create the event variable and store both the information you see in the while loop with information that I would store into a new while loop? I'm a little stumped
I have acollection of local variables populated via Flash movies and scripts, and now I need to submit an ajax post (can also be get, but prefer post). I have tried:
$.ajax({
type: "POST",
url: "/myurl",
data: "p1=" + localParam1 + "&p2=" + localParam2,
success: function(msg){
alert( Bingo: " + msg );
}
});
The problem with this is the encoding of the localParam1 and localParam2 sometimes breaks the normal & delimeters. An even more problem is I sometimes haveupwards of 25+ local variables that I need to submit. These inline +s makes it feel, and look, like one huge hack - not to mention the encoding. One last restriction: I cannot use any jquery plugins due to the company's policy. So, I'm looking for something small and light as a solution - not a plug-in. Isn't there an easy way to do this? ONe thought I had was to create a new <form> on the page, and insert the variables as new <input /> fields - and then finally submit the entire form. Again, a big hack + css