I have a textarea and i am using a plugin for that textarea. In that plugin there is a function getCode() which will return the value of the textarea. That function will be called like - textarea_id.getCode();
I am using ASP.NET in which i have declared the textarea (runat=server), and the textarea'a id i can get but when i am writing the following code it is not calling the method.
'<%= txtName.ClientID %>'.getCode();
But if i am writing then it is working fine.
ctrl001_txtxName.getCode();
Because the first one is a string and the second one i guess is an object. If so then how to overcome this problem. Can 开发者_运维知识库anyone please help?
Code Block
Plugin = function(obj)
{
var self = document.createElement('iframe');
self.textarea = obj;
self.textarea.disabled = true;
self.textarea.style.overflow = 'hidden';
self.style.height = self.textarea.clientHeight + 'px';
self.style.width = self.textarea.clientWidth + 'px';
self.textarea.style.overflow = 'auto';
self.style.border = '1px solid gray';
self.frameBorder = 0; // remove IE internal iframe border
self.style.visibility = 'hidden';
self.style.position = 'absolute';
self.options = self.textarea.className;
self.initialize = function()
{
self.editor = self.contentWindow.CodePress;
self.editor.body = self.contentWindow.document.getElementsByTagName('body')[0];
self.editor.setCode(self.textarea.value);
self.setOptions();
self.editor.syntaxHighlight('init');
self.textarea.style.display = 'none';
self.style.position = 'static';
self.style.visibility = 'visible';
self.style.display = 'inline';
}
self.getCode = function()
{
return self.textarea.disabled ? self.editor.getCode() : self.textarea.value;
}
return self;
}
document.getElementById('<%= txtName.ClientID %>').getCode();
精彩评论