如何在潜水标签中添加onclick事件

时间:2014-04-24 17:12:30

标签: html css

       <div id="diagram"></div>
    <div class="get">
        <div class="arc">
        <span class="text">WebPlus</span>
            <input type="hidden" class="percent" value="95" />
            <input type="hidden" class="color" value="#DD9F51" />
        </div>
        <div class="arc">
            <span class="text">DrawPlus</span>
            <input type="hidden" class="percent" value="90" />
            <input type="hidden" class="color" value="#D84F5F" />
        </div>
        <div class="arc">
            <span class="text">PhotoPlus</span>
            <input type="hidden" class="percent" value="80" />
            <input type="hidden" class="color" value="#88B8E6" />
        </div>
        <div class="arc">
            <span class="text">PagePlus</span>
            <input type="hidden" class="percent" value="53" />
            <input type="hidden" class="color" value="#BEDBE9" />
        </div>
        <div class="arc">
            <span class="text">MoviePlus</span>
            <input type="hidden" class="percent" value="65" />
            <input type="hidden" class="color" value="#EAC58C" />
        </div>
    </div>

这是我的div标签我在arc类中调用span标签值如何使这个div成为onclick标签

2 个答案:

答案 0 :(得分:0)

<div onclick="thisisafunction()" class="get">

function thisisafunction() {
     doSomething;
}

希望这有帮助!

答案 1 :(得分:0)

有两个步骤

1]

<div onclick="function_name()">text</div>

function function_name() {
   //doSomething
}

2]

<div id="event">text</div>

$(function () {
   $('#event').on('click', function () {
        //doSomething
   )};
)};