0

我有两个矩形,里面有一些文字。我想在单击每个警报时显示不同的警报,但下面的代码不起作用(不显示警报)。有任何想法吗?谢谢

<div id="panel0" style="width: 100%">
    <div class="titleBox" id="rect0" onclick="alert('yeah1');"
        style="height: 85px; width: 85px;">Hello</div>
    <div class="titleBox" id="rect1" onclick="alert('yeah2');"
        style="height: 85px; width: 85px;">Hello</div>
</div>
4

1 回答 1

3

试试这个

<div id="rect0" onclick="alert('yeah1');" style="height: 85px; width: 85px; background-color: #ff0000;">
     Hello
</div>                        
于 2012-05-18T11:29:54.727 回答