• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 547
  • Last Modified:

Fitering option with doubleclick event

I have manage to filter an select list with jscript like making copy and using regexp for filtering, this is a part for making copy

    this.optionscopy = new Array();
    if (this.selectobj && this.selectobj.options) {
      for (var i=0; i < this.selectobj.options.length; i++) {

        // Create a new Option
        this.optionscopy[i] = new Option();

        // Set the text for the Option
        this.optionscopy[i].text = selectobj.options[i].text;

        // Set the value for the Option.
        // If the value wasn't set in the original select list,
        // then use the text.
        if (selectobj.options[i].value) {
          this.optionscopy[i].value = selectobj.options[i].value;
        } else {
          this.optionscopy[i].value = selectobj.options[i].text;

this is working OK but the problem is that I'm having like ondoubleclick event on every option like:

<option ondblclick="eval(parent.location='test.php?id=5')">

and it is working until I use my filter.When I use filter and when my select component is filtered out ondoubleclick option is gone.
I have tried to add this:

this.optionscopy[i].ondblclick = selectobj.options[i].ondblclick;

but it wouldn't help.Can someone tell me can I carry this doubleclick event to copied object somehow or I must find the other way by using value of copied options?
1 Solution
can you try this:

this.optionscopy[i].ondblclick = function () {
  eval (parent.location='test.php?id=5');

if you really want to just call the same one the other method is calling instead, do this:

this.optionscopy[i].ondblclick = function () {
  var otherOptions = selectobj.options[i];
  otherOptions.ondblclick ();  // Should invoke its dblclick method...
do you probably mean:

You know that the browsers security model should inhibit that child windows change the parent window?

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now