Table of Contents
回复讨论(解决方案)
Home Web Front-end HTML Tutorial onmouseover 反应慢 一闪就过去 是为啥?_html/css_WEB-ITnose

onmouseover 反应慢 一闪就过去 是为啥?_html/css_WEB-ITnose

Jun 21, 2016 am 09:46 AM

jquery color class

先附上代码 

<table  width="100%" border="0" cellspacing="1" cellpadding="0"  >                                <tr height="27" align="center" style="color:#fff;">                                        <td width="17%" height="35" bgcolor="#19283e"        class="th01">a</td>                                        <td width="33%" height="35" bgcolor="#19283e" class="th01">b</td>                                        <td width="10%" height="35" bgcolor="#19283e" class="th01">c</td>                                        <td width="33%" height="35" bgcolor="#19283e" class="th01">d</td>                                        <td width="8%" height="35" bgcolor="#19283e" class="th01">e</td>                                </tr>                                <tr>                                        <td colspan="7" height="25" align="left" >                                                <table height="26" width="100%" cellspacing="0" cellpadding="0" style="margin-top:10px; background:url(/images/main/img09.gif);">                                                        <tr>                                                                <td style="padding-left:8px;" width="21"><img  align='absmiddle' src='/UpFile/League/Icon_51001627082010.jpg'    style="max-width:90%"  style="max-width:90%"/ alt="onmouseover 反应慢 一闪就过去 是为啥?_html/css_WEB-ITnose" ></td>                                                                <td style="padding-left:7px;" class="txt09">a--- D1</td>                                                        </tr>                                                  </table>                                        </td>                                  </tr>                                            <tr>                                <!--        <td colspan="5" align="center" class="txt10" style="padding-left:4px;">                    <table width="100%" id="box-table-a">                    <tr>-->                                        <td  align="center" style="padding-left:4px;">09/29 11:00</td>                                        <td  align="center"  id="id1_415520" class="list_td"  onclick="addCart('ggu12',415520,1,'SMP','2013-09-29 11:00/sh:ke/SMP');"  onMouseover="highlight(this, true);" onMouseOut="highlight(this, false);" >                                <span style="float:left;">sh</span>                                <span style="float:right;">205</span></td>                                        <td  align="center" id="id0_415520"         onMouseover="highlight(this, true);" onMouseOut="highlight(this, false);"                                         class="list_td"        onclick="addCart('ggu12','415520',0,'SMP','2013-09-29 11:00/sh:ke/SMP');"        >                                320                                                                        </td>                                        <td  class="list_td" id="id2_415520" class="list_td" onclick="addCart('ggu12',415520,2,'SMP','2013-09-29 11:00/sh:ke/SMP');" onMouseOver="highlight(this, true);" onMouseOut="highlight(this, false);"><span style="float:left;">3030</span><span style="float:right;">ke</span></td>                                        <td  align="center"  style="background-color:#2b2b2b; cursor:arow;"><font color="#FFCC00">ppl</font></td>                        <!--        </tr>                                </table>                                </td>-->                        </tr></table><sript>function highlight(obj, isHover) {        var cssClass = obj.className;        //alert(cssClass);        if(cssClass == "" || cssClass == "MouseOver") {                obj.className = isHover ? "MouseOver" : "";                return;    }    var color = "#000000";    var oddColor = "#000000";                        if(isHover) {                //obj.style.backgroundImage = "url(/images/main/bg19.gif)";                //alert(cssClass);                obj.style.backgroundColor = "#FFCC00";                obj.style.borderColor = "#ffe066 #907608 #907608 #ffe066";        } else {            color = "";            oddColor = "";                obj.style.backgroundColor = "";                obj.style.borderColor = "";                //obj.style.backgroundImage = "url(/images/main/bg09.gif)";    }        obj.style.color = color;                                         // set color of this element        var tds = obj.getElementsByTagName("TD");        // and all child TDs        for (var i = 0; i < tds.length; i++) {            if (tds[i].className == "odd") {                        tds[i].style.color = color;            } else {                tds[i].style.color = color;            }        }                }</script>
Copy after login




以上代码里 tr是循环出来的。 我附上的是其中一个table的数据

问题是td里的 onmouseover/out 效果 反应慢 鼠标上去了有的不会变效果 在一个 td里来回一下才出现效果 有时还是一闪就没了。 不知道是什么原因 。有没有人知道? 困惑了 2天 在不行 高手请求以上代码 改为 jquery的 也行 jquery 替代 onmouseover 效果。


回复讨论(解决方案)

<table  width="100%" border="0" cellspacing="1" cellpadding="0"  >                                <tr height="27" align="center" style="color:#fff;">                                        <td width="17%" height="35" bgcolor="#19283e"        class="th01">a</td>                                        <td width="33%" height="35" bgcolor="#19283e" class="th01">b</td>                                        <td width="10%" height="35" bgcolor="#19283e" class="th01">c</td>                                        <td width="33%" height="35" bgcolor="#19283e" class="th01">d</td>                                        <td width="8%" height="35" bgcolor="#19283e" class="th01">e</td>                                </tr>                                <tr>                                        <td colspan="7" height="25" align="left" >                                                <table height="26" width="100%" cellspacing="0" cellpadding="0" style="margin-top:10px; background:url(/images/main/img09.gif);">                                                        <tr>                                                                <td style="padding-left:8px;" width="21"><img  align='absmiddle' src='/UpFile/League/Icon_51001627082010.jpg'    style="max-width:90%"  style="max-width:90%"/ alt="onmouseover 反应慢 一闪就过去 是为啥?_html/css_WEB-ITnose" ></td>                                                                <td style="padding-left:7px;" class="txt09">a--- D1</td>                                                        </tr>                                                  </table>                                        </td>                                  </tr>                                            <tr>                                <!--        <td colspan="5" align="center" class="txt10" style="padding-left:4px;">                    <table width="100%" id="box-table-a">                    <tr>-->                                        <td  align="center" style="padding-left:4px;">09/29 11:00</td>                                        <td  align="center"  id="id1_415520" class="list_td"  onclick="addCart('ggu12',415520,1,'SMP','2013-09-29 11:00/sh:ke/SMP');"  onMouseover="highlight(this, true);" onMouseOut="highlight(this, false);" >                                <span style="float:left;">sh</span>                                <span style="float:right;">205</span></td>                                        <td  align="center" id="id0_415520"         onMouseover="highlight(this, true);" onMouseOut="highlight(this, false);"                                         class="list_td"        onclick="addCart('ggu12','415520',0,'SMP','2013-09-29 11:00/sh:ke/SMP');"        >                                320                                                                        </td>                                        <td  class="list_td" id="id2_415520" class="list_td" onclick="addCart('ggu12',415520,2,'SMP','2013-09-29 11:00/sh:ke/SMP');" onMouseOver="highlight(this, true);" onMouseOut="highlight(this, false);"><span style="float:left;">3030</span><span style="float:right;">ke</span></td>                                        <td  align="center"  style="background-color:#2b2b2b; cursor:arow;"><font color="#FFCC00">ppl</font></td>                        <!--        </tr>                                </table>                                </td>-->                        </tr></table><script tepe="javascrit/text">function highlight(obj, isHover) {        var cssClass = obj.className;        //alert(cssClass);        if(cssClass == "" || cssClass == "MouseOver") {                obj.className = isHover ? "MouseOver" : "";                return;    }    var color = "#000000";    var oddColor = "#000000";                        if(isHover) {                //obj.style.backgroundImage = "url(/images/main/bg19.gif)";                //alert(cssClass);                obj.style.backgroundColor = "#FFCC00";                obj.style.borderColor = "#ffe066 #907608 #907608 #ffe066";        } else {            color = "";            oddColor = "";                obj.style.backgroundColor = "";                obj.style.borderColor = "";                //obj.style.backgroundImage = "url(/images/main/bg09.gif)";    }        obj.style.color = color;                                         // set color of this element        var tds = obj.getElementsByTagName("td");        // and all child TDs        for (var i = 0; i < tds.length; i++) {            if (tds[i].className == "odd") {                        tds[i].style.color = color;            } else {                tds[i].style.color = color;            }        }                }</script>
Copy after login

试试吧

2楼 没什么改变啊 就是

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What is the purpose of the <datalist> element? What is the purpose of the <datalist> element? Mar 21, 2025 pm 12:33 PM

The article discusses the HTML &lt;datalist&gt; element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

What is the purpose of the <progress> element? What is the purpose of the <progress> element? Mar 21, 2025 pm 12:34 PM

The article discusses the HTML &lt;progress&gt; element, its purpose, styling, and differences from the &lt;meter&gt; element. The main focus is on using &lt;progress&gt; for task completion and &lt;meter&gt; for stati

How do I use HTML5 form validation attributes to validate user input? How do I use HTML5 form validation attributes to validate user input? Mar 17, 2025 pm 12:27 PM

The article discusses using HTML5 form validation attributes like required, pattern, min, max, and length limits to validate user input directly in the browser.

What is the purpose of the <iframe> tag? What are the security considerations when using it? What is the purpose of the <iframe> tag? What are the security considerations when using it? Mar 20, 2025 pm 06:05 PM

The article discusses the &lt;iframe&gt; tag's purpose in embedding external content into webpages, its common uses, security risks, and alternatives like object tags and APIs.

What is the purpose of the <meter> element? What is the purpose of the <meter> element? Mar 21, 2025 pm 12:35 PM

The article discusses the HTML &lt;meter&gt; element, used for displaying scalar or fractional values within a range, and its common applications in web development. It differentiates &lt;meter&gt; from &lt;progress&gt; and ex

What is the viewport meta tag? Why is it important for responsive design? What is the viewport meta tag? Why is it important for responsive design? Mar 20, 2025 pm 05:56 PM

The article discusses the viewport meta tag, essential for responsive web design on mobile devices. It explains how proper use ensures optimal content scaling and user interaction, while misuse can lead to design and accessibility issues.

What are the best practices for cross-browser compatibility in HTML5? What are the best practices for cross-browser compatibility in HTML5? Mar 17, 2025 pm 12:20 PM

Article discusses best practices for ensuring HTML5 cross-browser compatibility, focusing on feature detection, progressive enhancement, and testing methods.

How do I use the HTML5 <time> element to represent dates and times semantically? How do I use the HTML5 <time> element to represent dates and times semantically? Mar 12, 2025 pm 04:05 PM

This article explains the HTML5 &lt;time&gt; element for semantic date/time representation. It emphasizes the importance of the datetime attribute for machine readability (ISO 8601 format) alongside human-readable text, boosting accessibilit

See all articles