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
i want to hide and show a section in html
Moderator: General Moderators
-
lokesh_kumar_s
- Forum Commoner
- Posts: 48
- Joined: Mon Apr 13, 2009 5:39 am
- Contact:
-
Marinusjvv
- Forum Commoner
- Posts: 29
- Joined: Wed Dec 02, 2009 5:59 am
Re: i want to hide and show a section in html
Why don't you use an if statement and document.write?
-
lokesh_kumar_s
- Forum Commoner
- Posts: 48
- Joined: Mon Apr 13, 2009 5:39 am
- Contact:
Re: i want to hide and show a section in html
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>