hi
I have a freetextbox, a hiddenfield and a button on my web page. By pressing the button it insert the text from hiddenfield into freetextbox at current cursor position. I am doing this task using java script. when I run the webpage it give me Object required error. The code is given below
//Javascript Code
<script type="text\Javascript">
function Show()
{
var ctrl =
document.getElementById("txtTargetText");
var saveText = ctrl.value;
ctrl.focus();
var range = document.selection.createRange();
var specialchar = String.fromCharCode(1);
range.text = specialchar;
var pos = ctrl.value.indexOf(specialchar);
ctrl.value = saveText;
range = ctrl.createTextRange();
range.move('character', pos);
range.select();
range.text =
document.getElementById("txtSourceText").value;
document.getElementById("txtTargetText").focus();
window.event.returnValue = false;
}
</ script>
// HTML Code
<FTB:FreeTextBox id="FreeTextBox1" toolbarlayout="ParagraphMenu,FontFacesMenu,FontSizesMenu,
FontForeColorsMenu,FontForeColorPicker,FontBackColorsMenu,
runat="Server" DesignModeCss="designmode.css"/>
<asp:HiddenField ID="HiddenField1" runat="server" />
<asp:Button ID="btnInsert" Text="Insert Text" CssClass="button" runat="server" />
I have registered the click event on pageload
protected void Page_Load(object sender, EventArgs e)
{
HiddenField1.Value = Guid.NewGuid().ToString();
btnInsert.Attributes.Add("onClick", "Show()");
}
When I run this page it give me error
"Object required"
Object required FormBuilder.aspx, line 644 character 29
Please help me