When jQuery uses the content set in html () to contain jQuery code, the IE browser is slow to respond.

Source: Internet
Author: User
Recently, I tried to develop a simple online report. The basic workflow is as follows: The index.html page contains divelements, id"div_result"and there is no such content. The index.html page has a jQuery code to use $. get () to test. php sends a request and the returned content... recently, I tried to develop a simple online report. The basic workflow is as follows:

Index.htmlThere is a DIV element in the page, id ="P_result", No content by default;
Index.htmlThe page has a piece of jQuery code to use.$. Get ()Direction/Test. phpSend the request and return the html code of a table. use $ ("# P_result"Pai.html () is output to the p element of the current page.

The returned html code (table) contains jQuery code, which is used to process the table style (the rows are discolored and the selected rows are highlighted ).

Problems:
InChromeIn the browser: move the mouse over the table quickly, and the response speed of the special effects highlighted by the selected row is very fast.
In allIEIn the browser: the effect is obviously choppy, regardless of the number of rows in the table.

Stop$ ("P_result" pai.html (), ManuallyIndex.htmlInP elementAdd a static table and fill in the test data. Use the same jQuery code to Process Table effects. chrome and IE respond very quickly.

The main code is as follows:



Script function get_data (tb_typ) {$. ajax ({type: "get", url: "result. php ", data:" table_type = "+ tb_typ, cache: false, success: function(data={}('{result_p'}.html (data) ;}, databype:" html "})} $ (document ). ready (function () {var dataVal = "orders"; get_data (dataVal); // transcode the data in the row. Highlight var tb_obj = $ ('# my_table '); tb_obj.find ('tr: even '). addClass ('row _ even'); tb_obj.find ('tr: odd '). addClass ('row _ odd'); tb_obj.find ('tr '). not (': first '). mouseover (function () {$ (this ). addClass ('tr _ over ');}). mouseout (function () {$ (this ). removeClass ('tr _ over') ;}); script

Reply content:

Recently, I tried to develop a simple online report. The basic workflow is as follows:

Index.htmlThere is a DIV element in the page, id ="P_result", No content by default;
Index.htmlThe page has a piece of jQuery code to use.$. Get ()Direction/Test. phpSend the request and return the html code of a table. use $ ("# P_result"Pai.html () is output to the p element of the current page.

The returned html code (table) contains jQuery code, which is used to process the table style (the rows are discolored and the selected rows are highlighted ).

Problems:
InChromeIn the browser: move the mouse over the table quickly, and the response speed of the special effects highlighted by the selected row is very fast.
In allIEIn the browser: the effect is obviously choppy, regardless of the number of rows in the table.

Stop$ ("P_result" pai.html (), ManuallyIndex.htmlInP elementAdd a static table and fill in the test data. Use the same jQuery code to Process Table effects. chrome and IE respond very quickly.

The main code is as follows:



Script function get_data (tb_typ) {$. ajax ({type: "get", url: "result. php ", data:" table_type = "+ tb_typ, cache: false, success: function(data={}('{result_p'}.html (data) ;}, databype:" html "})} $ (document ). ready (function () {var dataVal = "orders"; get_data (dataVal); // transcode the data in the row. Highlight var tb_obj = $ ('# my_table '); tb_obj.find ('tr: even '). addClass ('row _ even'); tb_obj.find ('tr: odd '). addClass ('row _ odd'); tb_obj.find ('tr '). not (': first '). mouseover (function () {$ (this ). addClass ('tr _ over ');}). mouseout (function () {$ (this ). removeClass ('tr _ over') ;}); script
Related Article

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.