Page 1 of 1
i want to hide and show a section in html
Posted: Thu Jan 21, 2010 2:23 am
by lokesh_kumar_s
eg:
Code: [Select]
<div id='con'>
<h1>hello</h1>
</div>
<div id='cal'>
<h2>hello</h2>
</div>
i want to hide div id 'con' and show div id 'cal' on some event . and toggle on another event. so please tell me how can i hide it
Re: i want to hide and show a section in html
Posted: Thu Jan 21, 2010 2:26 am
by Marinusjvv
Why don't you use an if statement and document.write?
Re: i want to hide and show a section in html
Posted: Thu Jan 21, 2010 2:28 am
by papa
Re: i want to hide and show a section in html
Posted: Thu Jan 21, 2010 2:32 am
by lokesh_kumar_s
Marinusjvv wrote:Why don't you use an if statement and document.write?
Code: Select all
<javascript type="text/javascript">
function Enable(form)
{
//myform.rdoWise.value
//a variable that will hold the index number of the selected radio button
alert("coming here");
var theone;
for (i=0;i<form.rdoDomainType.length;i++)
{
if (form.rdoDomainType[i].checked==true)
{
theone=i;
break //exist for loop, as target acquired.
}
}
//alert(myform.rdoWise[theone].value);
var val=form.rdoDomainType[theone].value;
alert(val);
if(val=="con")
{
document.getElementById('ForCallCenter').style.display='hidden';
//document.getElementById('ForCallCenter').
document.getElementById('ForContractor').style.display='visible';
}
else if(val=="cal")
{
document.getElementById('ForCallCenter').style.display='visible';
document.getElementById('ForContractor').style.display='hidden';
}
}
</javascript>
<div id="ForCallCenter">
<?php if(!isset($_SESSION['secman'])): ?>
<tr>
<th class="RowWiseHeader" align="right" style="width: 301px">Company Name
</th>
<td align="left">
<?php include('inc/DbConnect.php');
$result=mysql_query("select CompanyName from SecManager_Profile where CompanyName !=''") or die("could not execute");
?>
<select name="txtCompanyName" style="width: 158px">
<option value="">SELECT</option>
<?php while($array=mysql_fetch_row($result)): ?>
<option value="<?php echo $array[0]; ?>"><?php echo $array[0]; ?></option>
<?php endwhile; ?>
<?php mysql_close(); ?>
</select></td>
</tr>
<?php endif; ?>
<!--/div-->
</div>
<div id="ForContractor">
hffh
</div>
i want to do like this can i use any other tags other than div for that