How do you do html text encodes using JavaScript
How do you do html text encodes using JavaScript:
In this post we describe how to encode Text on web page by
using JavaScript. In this Example we take two textbox one for take text by user
and second for giving result.
HTML Encode and Decode with Javascript:
function encode(text)
{
Ref="0123456789abcdefghijklmnopqrstuvwxyz.-~ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Result=""
for (Count=0; Count<text.length; Count++)
{
Char=text.substring (Count, Count+1);
Num=Ref.indexOf (Char);
EncodeChar=Ref.substring(Num+1, Num+2)
Result += EncodeChar
}
document.form1.result.value=Result
}
Client side HTML encoding and decoding:
<!DOCTYPE html PUBLIC "-//W3C//DTD
XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<script language="JavaScript">
<!-- Beginning of JavaScript Programer-
function encode(text)
{
Ref="0123456789abcdefghijklmnopqrstuvwxyz.-~ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Result=""
for (Count=0; Count<text.length; Count++)
{
Char=text.substring (Count, Count+1);
Num=Ref.indexOf (Char);
EncodeChar=Ref.substring(Num+1, Num+2)
Result += EncodeChar
}
document.form1.result.value=Result
}
// - End of JavaScript - -->
</script>
</head>
<body>
<form name="form1"
runat="server">
<div align="center">
<h1>
HTML encoding or decoding content client side using Javascript.
</h1>
<br />
<table border="2">
<tr>
<td>
Enter your word<td>
<input name="input"
type="Text"><br>
<tr>
<td>
Encoding
Result:<td>
<input name="result"
type="Text">
<tr>
<td>
<td align="left">
<input
type="Button"
value="submit"
onclick="encode(this.form.input.value)"
style="width: 130px;
height: 28px">
</table>
</div>
</form>
</body>
</html>
Text encodes using JavaScript:
html text encodes using JavaScript |
JavaScript HTML Encode and HTMLDecode functions:
Here are a few types of commands that methods are useful
for.
- Date Methods - set variables to the clock time in a variety of ways.
- Document Methods - Generate new documents on the fly.
- Form Methods - select form items, send the cursor to text boxes and submit forms.
- History Methods - Press the reader's 'Back' button and other tricks.
- Window Methods - used to open and close new windows
- MessageBox Methods - Alert, Prompt, and Confirm are all methods.
- Text Methods - Define the look of your text variables before your display them.
- Math Methods - sin, cos, round, random, absolute value, etc.
window.open method encoding or decoding content client side using JavaScript:
The window.open function can have three optional parameters.
- A URL.
- A title of new window
- Options for the window's appearance and also including height and width.
Other Asp.net and JavaScript Related Post:
- Check Uncheck all asp.net CheckBox in asp.net using jQuery
- Example of jQuery Validate on Radiobuttonlist in Asp.Net using C#
- Example jQuery Validate on CheckBoxList using C#
- Check Uncheck all html CheckBox controls using jQuery:
- fill data into Dropdown list by using Jquery
- Validate ASP.Net RadioButtonList using JavaScript Example
- Example of jQuery Validate on Radiobuttonlist in Asp.Net using C#
- Example jQuery Validate on CheckBoxList using C#
- Check Uncheck all asp.net CheckBox in asp.net using jQuery
- Check Uncheck all html CheckBox controls using jQuery:
- Asp.net CheckBoxList using jQuery.
- Cropping image using jQuery in asp.net
- javascript checkbox example onclick,
- checkbox validation using javascript,
- checkbox using javascript,
- checkbox validation using javascript in html,
- how to uncheck checkbox using javascript,
- check checkbox using javascript,
- enable checkbox using javascript
- create javascript array list.
- access literal control using javascript.
- literal control
- display elements on button clicked.
- hide radio buttons in javascript on.
- show and hide div by javascript.
- Asp checkboxlist control demo:
- Checkboxlist in asp.net(control example)
- Asp checkboxlist Example using C#.
- Limit Number of Characters in a TextArea using jQuery
- Get selected radio button values using JQuery
- How do you do html text encodes using JavaScript
Comments
Post a Comment