Jump to content

Javascript textarea escape < and >


arunpatal

Recommended Posts

<script>

function iFrameOn(){
richTextField.document.designMode = 'On';
}
function iBold(){
richTextField.document.execCommand('bold',false,null);
}
function iUnderline(){
richTextField.document.execCommand('underline',false,null);
}

function submit_form(){
var theForm = document.getElementById("myform");
theForm.elements["myTextArea"].value = window.frames['richTextField'].document.body.innerHTML;
theForm.submit();
}

function createDiv() {
var divTag = document.createElement('div',false,null);

divTag.id = "div1";
divTag.style.border = "1px solid #333";
divTag.className = "dynamicDiv";

divTag.innerHTML = "This HTML Div tag created "
+ "using Javascript DOM dynamically.";

window.frames['richTextField'].document.body.appendChild(divTag);
}

</script>
<body onLoad="iFrameOn();">
<table><td width="100%" valign="top">
<h2>My web application that intakes data from users</h2>

<form action="richtext.php" name="myform" id="myform" method="post">

<div id="wysiwyg_cp" style="padding:8px; width:700px;">
<input type="button" onClick="iBold()" value="B">
<input type="button" onClick="iUnderline()" value="U">
<input id="btn1" type="button" value="create div" onClick="createDiv();" />

</div>

<textarea style="display:none;" name="myTextArea" id="myTextArea" cols="100" rows="14">

</textarea>
<iframe name="richTextField" id="richTextField" value="11" style="border:#000000 1px solid; width:700px; height:300px;">
</iframe>

<br /><br /><input name="myBtn" type="button" value="Submit Data" onClick="javascript:submit_form();"/>
</form>
</td>
</table>

I want that when javascript ['richTextField'] pass value to ["myTextArea"]....

It dosent change < and > to < and >......

 

can i make a array where i write words & these word will exchange with another word (or another array) and then ['richTextField'] pass value to ["myTextArea"].

 

 

with array i mean somthing like this

replace('<', '<').replace('>', '>')
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.