Wednesday, 25 September 2013

Background color doesn't apply after changing visibility

Background color doesn't apply after changing visibility

The pink background color disappear after I change the visibility of the
container ul tag. The codes are as follows. Did I miss something ? Why
does the li doesn't inherit the background color of ul tag?
<style type="text/css">
.div_r3r4_container { width:760px; background-color:lightblue; }
.div_r3_class { margin-left:132px; width:630px; }
.ul_r3hz_class { background-color:pink; font-size:0px; padding:2px 2px
1px 3px;list-style:none;margin:0; }
.li_r3hz_class { font-size:14px; color:black; display:inline; }
.ul_r4hz_class {background-color:yellow; font-size:0px; border:1px solid
red; padding:1px 2px 2px 3px;list-style:none;margin:0; }
.li_r4hz_class {font-size:14px; color:green; display:inline; }
</style>
<div id="div_r3_r4_id" class="div_r3r4_container">
<label id="city"> hide and show ul </label>
<div class="div_r3_class" >
<ul class="ul_r3hz_class" id="sid" >
<li class="li_r3hz_class"> aaaa, aaaa1, aaa2, aaa3, </li>
<li class="li_r3hz_class"> aaaaa4, aaaa5, aaaa5, aaa6, </li>
</ul>
</div>
<div class="div_r4_class" >
<ul class="ul_r4hz_class" >
<li class="li_r4hz_class"> bb, bbb, bbbb, bbbb2, bbbb3 </li>
<li class="li_r4hz_class"> bbbb5, bbb6, bbb7, bbb8, </li>
</ul>
</div>
</div>
<div>
<input id="minus" value="-" type="submit" style="background-color:white;
float:right; font-size:6px;" onClick="hide_show_div('sid', 'minus', 'plus'
); return flase; ">
<input id="plus" value="+" type="submit" style="background-color:white;
float:right; font-size:6px;" onClick="show_hide_div('sid',
'minus','plus','div_r3_class' ); return flase; ">
</div>
<script language = "JavaScript">
function hide_show_div( hideid1, hideid2, showid1 ){
hideObjDiv( hideid1 ) ;
hideObjDiv( hideid2 ) ;
showObjDiv( showid1 ) ;
}
function show_hide_div( showdivid1, showid2, hideid1, newclass ){
hideObjDiv( hideid1 ) ;
showObjDiv( showid2 ) ;
showObjDiv( showdivid1 ) ;
}
function hideObjDiv(obj) {
if (document.getElementById) {
document.getElementById(obj).style.visibility = 'hidden';
document.getElementById(obj).style.display = 'none';
}
}
function showObjDiv(obj) {
if (document.getElementById) {
document.getElementById(obj).style.visibility = 'visible';
document.getElementById(obj).style.display = 'inline';
}
}
</script>

No comments:

Post a Comment