虽然在 jquery click 事件上第一次获得了价值,但第二次它变空了
JS:
$(".topPanel").live('click', (function(e) {
form = $(e.target).attr("name");
content = $("." + form);
$(".show_panel1").html("");
$(".show_panel1").html(content);
$(".show_panel1").show();
}));
HTML:
<div class="topPanel" >
<span id="5" name="panther" style="background: #990000;" class="span_1">
Panther</span>
<span id="6" name="lion" style="background: #009900;" class="span_1">
Lion</span>
</div>
<div class="show_panel1" >
<label class="label">welcome</label>
</div>
<div class="tiger" >
<label class="label">i am panther</label>
</div>
<div class="lion" >
<label class="label">i am lion</label>
</div>
CSS
.label
{
font-family: Verdana;
font-size: medium;
font-weight:lighter;
color: #FF990000;
float:inherit;
margin:10mm;
}
.topPanel
{
float: left;
color:#000000;
background: none repeat scroll 0% 0% orange;
width: 1280px;
margin: 10px 5px 5px 10px;
}
.span_1
{
float: left;
height: 40px;
width:5%;
padding:20px;
margin: 0px 5px 0px 0px;
}
</p>