[英]div style:hidden tag is taking space
I have a problem. 我有个问题。 I have two HTML buttons, and I want to show one at one time.
我有两个HTML按钮,我想一次显示一个。 I have code which is working fine but the problem is of space.
我的代码工作正常,但问题出在空间上。 In the GUI, spaces of both buttons are present which is not acceptable.
在GUI中,两个按钮之间都存在空格,这是不可接受的。 I want to place both buttons on the same location.
我想将两个按钮都放在同一位置。
The code is: 代码是:
function searchWithin(id)
{
if(document.getElementById("searchwithin").checked)
{
document.getElementById('searchwithin_'+id+'_searchButton').style.visibility="visible";
document.getElementById(id+'-form-submit').style.visibility="hidden";
}
else
{
document.getElementById('searchwithin_'+id+'_searchButton').style.visibility="hidden";
document.getElementById(id+'-form-submit').style.visibility="visible";
}
}
<g2:button style="visibility:visible;" id="${g2:escapeXml(componentId)}-form-submit" name="submitButton" type="submit" value="Search" bamId="${searchBarBam}" actionName="${action}" inputClass="p-userSearchButton" />
<input style="visibility:hidden;" type="button" class="p-userSearchButton" name ="searchinresult" id="searchwithin_${componentId}_searchButton" value="Search Within" onClick="javascript:($C('${componentId}')).filterBySearchWithIn('${searchBarBam}','${componentId}-form-text');"></input>
I need to change it like: 我需要像这样更改它:
document.getElementById('searchwithin_'+id+'_searchButton').style.display="none";
document.getElementById(id+'-form-submit').style.display="true";
<g2:button style="display:true;"
id="${g2:escapeXml(componentId)}-form-submit"
name="submitButton"
type="submit"
value="Search"
bamId="${searchBarBam}"
actionName="${action}"
inputClass="p-userSearchButton" />
<input style="display:none;"
type="button"
class="p-userSearchButton"
name ="searchinresult"
id="searchwithin_${componentId}_searchButton"
value="Search Within"
onClick="javascript:($C('${componentId}')).filterBySearchWithIn('${searchBarBam}','${componentId}-form-text');"></input>
But it's not working. 但这不起作用。
You want display: none;
您要
display: none;
not visibility: hidden
. 不
visibility: hidden
。
Edit 编辑
In your edited code you use display: true
to show a button, but correct syntax would be: display: inline
. 在已编辑的代码中,使用
display: true
来显示按钮,但是正确的语法是: display: inline
。 For more display options view: w3schools.com/css/css_display_visibility.asp . 有关更多显示选项的视图,请访问: w3schools.com/css/css_display_visibility.asp 。
If this does not fix your problem, please define more clearly what your issue is exactly . 如果这不能解决您的问题,请更清楚地定义您的问题到底是什么 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.