* Bob Silva wrote (13/02/06 09:58):
> Cant. If you write a patch you can. I imagine it will work its way into
> scriptaculous eventually.

Here's some code from DWR:

/ * Copyright 2005 Joe Walker
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 */


 /**
 * Select a specific range in a text box.
 * This is useful for 'google suggest' type functionallity.
 * @param ele The id of the text input element or the HTML element itself
 * @param start The beginning index
 * @param end The end index
 */
DWRUtil.selectRange = function(ele, start, end) {
  var orig = ele;
  ele = $(ele);
  if (ele == null) {
    alert("selectRange() can't find an element with id: " + orig + ".");
    return;
  }
  if (ele.setSelectionRange) {
    ele.setSelectionRange(start, end);
  }
  else if (ele.createTextRange) {
    var range = ele.createTextRange();
    range.moveStart("character", start);
    range.moveEnd("character", end - ele.value.length);
    range.select();
  }
  ele.focus();
};


It might be useful for that patch.

Chris
_______________________________________________
Rails-spinoffs mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to