本文介绍了在div上更改文本颜色单击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我试图导航到不同页面点击

Hi
I am trying to navigate to different pages on click on the



这样做我想将文本的颜色更改为红色。它看起来很简单,但我搜索了许多无法得到正确答案的东西。

我的代码:


While doing that i want to change the color of the text as red. It looks simple but i googled many things not able to get the proper answer.
my code:
<div id="divMyInformation">
                <table cellpadding="0" cellspacing="0" class="vertNavMyInfo" id="tblMyInformation">
                    <tr class="lvl1" onmouseover="OnMouseHoverColor(this)"  önmouseout="OnMouseOutColor(this)">
                        <td class="imgLinks">
                            <div  önclick="location='../Home/MyPage.aspx'">My Page
                            </div>
                        </td>
                    </tr>
                    <tr class="lvl1" onmouseover="OnMouseHoverColor(this)"  önmouseout="OnMouseOutColor(this)">
                        <td class="imgLinks" >
                            <div  önclick="location='../Home/MyPage1.aspx'">
                                My Page1
                            </div>
                        </td>
                    </tr>
                    <tr class="lvl1" onmouseover="OnMouseHoverColor(this)"  önmouseout="OnMouseOutColor(this)">
                        <td class="imgLinks" >
                            <div  önclick="location='../Home/MyPage2.aspx'">
                                My Page2
                            </div>
                        </td>
                    </tr>
                </table>
            </div>

推荐答案

<!DOCTYPE html>
<html>
<head>
<style>
.clicked {color:red;}
</style>
<script type="text/javascript">





希望这会对你有所帮助。



问候,

RK


Hope this helps you a bit.

Regards,
RK


这篇关于在div上更改文本颜色单击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 06:00