Hi,
I'm having problems trying to call setTextSelectionRange() via javascript in the browser. I am able to call getTextSelectionRange() and get the coordinates of selected text.
I would like to be able to set the selected text via a javascript function. I'm not sure how to handle the "sel" object and what arguments to pass. Would you happen to have an example?
Thank you.
Bob
Example of Javascript Function for setTextSelectionRange
Re: Example of Javascript Function for setTextSelectionRange
Documentation for that method is found here:mallir wrote:I'm having problems trying to call setTextSelectionRange() via javascript in the browser.
I'm not sure how to handle the "sel" object and what arguments to pass. Would you happen to have an example?
http://print2flash.com/help/DocumentAPI ... ctionRange
...and here's an example that I whipped up that I hope will help you get started. Just treat the argument to the set method like a native JavaScript object:
Code: Select all
document.getElementById('p2fDoc').setTextSelectionRange({
headPageIdx: 1,
headCharIdx: 3,
tailPageIdx: 1,
tailCharIdx: 21
});
Last edited by jaymz on Fri May 09, 2008 2:50 pm, edited 1 time in total.
Re: Example of Javascript Function for setTextSelectionRange
Hi Jay,
Thanks alot for the snippet. This worked for me.
Also, FYI for anyone else; you can select the entire document by setting the range to a large number such as follows:
document.getElementById('Print2FlashDoc').setTextSelectionRange({
headPageIdx: 1,
headCharIdx: 0,
tailPageIdx: 100,
tailCharIdx: 999999
});
Thanks again,
Bob
Thanks alot for the snippet. This worked for me.
Also, FYI for anyone else; you can select the entire document by setting the range to a large number such as follows:
document.getElementById('Print2FlashDoc').setTextSelectionRange({
headPageIdx: 1,
headCharIdx: 0,
tailPageIdx: 100,
tailCharIdx: 999999
});
Thanks again,
Bob