你好,我想隐藏visibility:hidden
所采用的额外间距。在代码中,当我选择sort by date
时,它将被默认内容替换,但是当选择sort by topic
时,它会按日期输出进行排序。但我不想要这个。我想将sort of topic
的o/p替换为sort by date
。我认为这是因为使用visibility:hidden
。任何人都可以建议我如何删除该空间。我也使用display:none
,但没用。隐藏由能见度引起的额外间距:隐藏
<html>
<head>
<script>
function onloadfun()
{
document.getElementById("hideall").style.visibility="hidden";
}
function optionCheck()
{
if(document.getElementById("sorting").value=="bydate")
{
document.getElementById("topic1").style.visibility ="visible";
document.getElementById("topic").style.visibility ="hidden";
document.getElementById("showByDefault").style.display ="none";
}
if(document.getElementById("sorting").value =="bytopic")
{
document.getElementById("topic1").style.visibility ="hidden";
document.getElementById("topic").style.visibility ="visible";
document.getElementById("showByDefault").style.display ="none";
}
// validation of dropdownlist
var x = document.getElementById("sorting");
var option = x.options[x.selectedIndex].value;
var strUser1 = x.options[x.selectedIndex].text;
if(option=="s")
{
document.form.options.focus();
return false;
}
return true;
}
</script>
</head>
<body onLoad="onloadfun()">
<form name="form">
<select id="sorting" style="width:140px" onChange="optionCheck()">
<option id="s">---Sort By----</option>
<option value="bydate">Sort By Date</option>
<option value="bytopic">Sort By Topic</option>
</select>
</form>
<br /><br /><hr /><br /><br />
<?php include 'connection.php'; ?>
<div id="showByDefault">
<?php
echo "default content";
?>
</div>
<div id="hideall">
<div id="topic1">
<?php echo "hideing 1"; ?>
</div>
<div id="topic">
<?php echo "hideing 2"; ?>
</div>
</div>
</body>
</html>
请删除
标签,然后尝试 – Arun 2015-02-07 05:06:45
删除
inn't工作。删除
是不正确的方法来替换按主题内容排序。 – user3766182 2015-02-07 05:12:23
PHP提供的标记是什么样的?你能举一个简单的例子吗?任何CSS? – Xotic750 2015-02-07 05:16:31