Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to add row highlight using html, css, and javascript?
    text
    copied!<p>I want to know how I can make a row highlight using html, css, and javascript.</p> <p>Here are my codes:</p> <p><strong>people.html</strong></p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;&lt;/title&gt; &lt;link rel="stylesheet" type="text/css" href="stylesheet.css" /&gt; &lt;/head&gt; &lt;body&gt; &lt;div&gt; &lt;div width="100%"&gt; &lt;input type="text" id="searchCompGroupUser" name="searchCompGroupUser" size="100%"/&gt; &lt;input type="submit" id="searchCompGroupUser" name="searchCompGroupUser" value="Search"/&gt; &lt;input type="checkbox" id="isActive" name="isActive" checked="checked" /&gt; &lt;/div&gt; &lt;table class="dataTable"&gt; &lt;tr&gt; &lt;th width="40%"&gt;Name&lt;/th&gt; &lt;th width="60%"&gt;Address&lt;/th&gt; &lt;tr&gt; &lt;tr onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"&gt; &lt;td&gt;Tony&lt;/td&gt; &lt;td&gt;United States of America&lt;/td&gt; &lt;/tr&gt; &lt;tr onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"&gt; &lt;td&gt;Toby&lt;/td&gt; &lt;td&gt;United Arab Emirates&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;div class="controls"&gt; &lt;input type="submit" id="btnAdd" name="btnAdd" value="ADD" onclick="" /&gt; &lt;input type="submit" id="btnEdit" name="btnEdit" value="EDIT" onclick="" /&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>and my css:</p> <p><strong>stylesheet.css</strong></p> <pre><code>table.dataTable { width: 100%; margin-top: 10px; font-family: verdana,arial,sans-serif; font-size:12px; color:#333333; border-width: 1px; border-color: #666666; border-collapse: collapse; } table.dataTable tr.highlight { background-color: #8888ff; } table.dataTable tr.normal { background-color: #ffffff; } table.dataTable th { white-space: nowrap; border-width: 1px; padding: 8px; border-style: solid; border-color: #666666; background-color: #dedede; } table.dataTable td { border-width: 1px; padding: 8px; border-style: solid; border-color: #666666; background-color: #ffffff; } .controls { margin-top: 10px; float: right; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload