Browser selections

J. Landman Gay jacque at hyperactivesw.com
Mon Apr 8 14:47:04 EDT 2019


Thanks. I don't know JavaScript so it's a little over my head, but I'll 
try it.

On 4/8/19 6:22 AM, hh via use-livecode wrote:
> (Getting the selection of a browser widget: Aee my previous post).
> 
> Setting the selection of a browser widget:
> 
> Assume you have an element <a id='jlg1'>click me</a> in your webpage.
> Then the following selects char 1 to 4 of the link text (= "clic").
> 
> on mouseUp
>    put "var node = document.getElementById('jlg1').firstChild;" & \
>          "var range = document.createRange();" & \
>          "range.setStart(node, 0); range.setEnd(node, 3);" & \
>          "var selection = window.getSelection();" & \
>          "selection.removeAllRanges(); selection.addRange(range);" into js
>    do js in widget "Browser"
> end mouseUp
> 
> Note that setStart and setEnd are zero-based in counting chars.
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
> 


-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the use-livecode mailing list