By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,945 Members | 1,540 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,945 IT Pros & Developers. It's quick & easy.

Cross browser issue in createTextRange()

P: 58
the following code works fine in IE6 but does not work in Mozilla,any idea to fix this cross browser issue???

Code

Expand|Select|Wrap|Line Numbers
  1. PastedText = document.getElementById("hiddenText").createTextRange();
  2.                    PastedText.execCommand("Paste");
Regards,
Sundar
Aug 21 '09 #1
Share this Question
Share on Google+
5 Replies


Dormilich
Expert Mod 5K+
P: 8,639
createTextRange() is an IE specific implementation. the DOM method (used by Mozilla and others) is createRange().
Aug 21 '09 #2

P: 4
Similar problem here too:

I tried below in Mozilla,

Expand|Select|Wrap|Line Numbers
  1.   document.getElementById("tf").setSelectionRange(0,20);
  2.   document.execCommand("Paste", false, null);
It does not work.

Regards,
Joshua
Aug 21 '09 #3

P: 4
@Dormilich
This too does not work, getting the below error in Mozilla:

Error: document.getElementById("hiddenText").createRange is not a function
Aug 21 '09 #4

Dormilich
Expert Mod 5K+
P: 8,639
@joshbay84
similar answer too. in Mozilla setSelectionRange is only part of XUL.
Aug 21 '09 #5

Dormilich
Expert Mod 5K+
P: 8,639
@joshbay84
well the usage is different, see Range object @ MDC.
Aug 21 '09 #6

Post your reply

Sign in to post your reply or Sign up for a free account.