(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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to