i am using a JS code to obtain the cursor position on a text area..it works botyh in Mozilla and IE..But the problem is when am using this in IE, am getting an alert box which has the contents like [object] ...the code is like this
function getPositionForConstraint(node) {
if(node.selectionStart) {/* To work in mozilla */
retrieveURL('/Pinnacle/pg/hrm/payRuleEngine?reqCode=getPositionForConstraint&id='+node.selectionStart,'RuleEngineBean','setExpression,messageDiv');
return node.selectionStart;
}
else if(!document.selection){
retrieveURL('/Pinnacle/pg/hrm/payRuleEngine?reqCode=getPositionForConstraint&id='+0,'RuleEngineBean','setExpression,messageDiv');
return 0;
}/* to work in IE */
var c = "\001";
var sel = document.selection.createRange();
var dul = sel.duplicate();
var len = 0;
dul.moveToElementText(node);
sel.text = c;
len = (dul.text.indexOf(c));
sel.moveStart('character',-1);
sel.text = "";
retrieveURL('/Pinnacle/pg/hrm/payRuleEngine?reqCode=getPositionForConstraint&id='+len,'RuleEngineBean','setExpression,messageDiv');
}
the problem occur in last statement in which a method is called through ajax...
If it is not called through ajax, then no problem...
can u pls help me...