How JavaScript simulates the effect of selecting an OPTION element in a Drop-down box

Source: Internet
Author: User

Because we manually interact with an action, the first thing is to change some of its properties, followed by letting it trigger an event. It is easy to understand this. Let the property change, of course, change its intrinsic properties, so setattribute (AAA,BBB) is out, so it is used to set custom attributes (IE678, that's weird). Want to trigger events, we can use FireEvent or Dispathevent, Ali from the Yui Yahoo made a event-simulate, think more comprehensive, we want to go into the depth can refer to.

Here's what I've achieved:

<! DOCTYPE html>  

Of course, this is not rigorous enough, because I am using the human brain to assume some amount of calculation. We need to know if it has changed. So there's a function that compares the values before and after, and this can look here.

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/webkf/script/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.