remove returns




JavaScript Source Code 3000: Forms: Remove Returns








































Remove Returns







Converts carriage returns in a string to the tag so that the input can be properly displayed in HTML. Without the script, returns in an input field are not preserved when submitting in a form. Useful for guestbooks or other times when a user's input must be preserved.






You may type a message here

Make sure to press the [Enter] key a few times.

That way you will be able to see the

conversion function in action.




Output:







JavaScript Source Code 3000: Forms: Remove Returns
Simply click inside the window below, use your cursor to highlight the script, and copy (type Control-c or Apple-c) the script into a new file in your text editor (such as Note Pad or Simple Text) and save (Control-s or Apple-s). The script is yours!!!





    





<!-- TWO STEPS TO INSTALL REMOVE RETURNS:

1. Copy the coding into the HEAD of your HTML document
2. Add the last code into the BODY of your HTML document -->

<!-- STEP ONE: Paste this code into the HEAD of your HTML document -->

<HEAD>

<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Ascii King (chicorama@usa.net) -->
<!-- Web Site: http://www.geocities.com/enchantedforest/2120 -->

<! >
<! >

<!-- Begin
function ConvertBR(input) {
// Converts carriage returns
// to <BR> for display in HTML

var output = "";
for (var i = 0; i < input.length; i++) {
if ((input.charCodeAt(i) == 13) && (input.charCodeAt(i + 1) == 10)) {
i++;
output += "<BR>";
} else {
output += input.charAt(i);
}
}
return output;
}
// End -->
</script>
</HEAD>

<!-- STEP TWO: Copy this code into the BODY of your HTML document -->

<BODY>

<center>
<form>
<textarea name=message rows=8 cols=50>You may type a message here

Make sure to press the [Enter] key a few times.

That way you will be able to see the

conversion function in action.
</textarea>
<p>
<input type=button value="Convert Returns" onClick="this.form.output.value = ConvertBR(this.form.message.value);">
<p>
Output: <input type=text name=output size=50>
<p>
</form>
</center>



<!-- Script Size: 1.41 KB -->











Wyszukiwarka

Podobne podstrony:
function return
function hwapi object remove
AutoFormat RemoveEmpty
remove spell
removedirectory
40 97 Lower guide link remove & install
RemoveAttributeAction (2)
function mcve returnstatus
return?r
17 1 Lubrication system components remove and install
42 106 Wheel bearing housing remove & install
option remove script host
Monitoring the Risk of High Frequency Returns on Foreign Exchange
removepages
Alanis Morissette You owe me nothing in return
function swfmovie remove
function swf removeobject

więcej podobnych podstron