我正在创建一个非常简单的表单来向我的数据库添加信息。该按钮将显示两个元素的样式从display:none更改为:block。这样可行。但问题是表单文本框不可选。当我单击或双击表单时,选择了背景....我无法解释原因。我以前从未见过这种情况。
已发布的网站是www.impossibleparty.com/private/bookingList.php
代码如下:
相关信息: 我不是网站设计,html,css或php的初学者,所以你可以忽略代码布局中的缺陷。我只包括相关部分。标签就在那里以及所有必要的标题。这些都不是问题。我没有在IE中尝试过,但Safari 8.0.3和Firefox 39.0中存在问题。我在Dreamweaver中编写了代码。任何其他问题,随时问。我以前没有遇到过这个问题。
谢谢!
<body style='background: url(../images/IEwebBackground.jpg) no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; min-width: 800px; margin:0; padding:0;'>
<div id='container'>
<div id='banner'>
<img id="bannerImg1" src="../images/IEwebBanner.jpg" width="100%"/>
<img id="bannerImg2" src="../images/textWhite.png" width="40%" alt="Impossible Entertainment"/>
</div><!--End banner-->
<!--Main DIV LEAVE STYLE HERE-->
<div id='main' style="background-image: url(../images/IEwebForegroundLong.jpg);
background-origin:content-box;
background-size:cover;
background-repeat:repeat-y;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
position:relative;
height:65rem;
z-index:0;">
<img id='navBar' src="../images/IEwebNavBar2.png" style="width:90%; height:5%; left:5%;"/>
<div id="Left" style="float:left; width:70%; z-index:4;">
<div id="addEvent" style="z-index:6;">
<form name="bookingList" method="post" action="../private/bookingListForm.php">
<!--These buttons make different things visible-->
<!--The <p> tags are temporary just for easier layout. They did not change the problem-->
<p>
<button id="button1" type="button" onclick="document.getElementById('specEvent').style.display='block';document.getElementById('button1').style.display='none';document.getElementById('eventName').style.display='block';document.getElementById('button2').style.display='none'">Special Event</button>
<button id="button2" type="button" onclick="document.getElementById('weekEvent').style.display='block';document.getElementById('button2').style.display='none';document.getElementById('eventName').style.display='block';document.getElementById('button1').style.display='none'">In Week Event</button>
</p>
<!--These become visible after a button is pressed. This works-->
<label id="specEvent" style="display:none" for="event_name">Event Name</label>
<label id="weekEvent" style="display:none;" for="event_name">Event Name</label>
<input id="eventName" style="display:none;" type="text" name="event_name" maxlength="50" size="30">
<!--These are the forms that are not selectable. Sometimes they work, sometimes they don't....But they never all work at the same time-->
<p>
<label for="vendor_name">Venue Name *</label>
<input type="text" name="vendor_name" maxlength="50" size="30">
</p>
<p>
<label for="contact_name">Contact Name *</label>
<input type="text" name="contact_name" maxlength="50" size="30">
</p>
<p>
<label for="vendor_phone">Venue Phone Number *</label>
<input type="text" name="vendor_phone" maxlength="50" size="30">
</p>
<p>
<label for="contact_title">Contact Title *</label>
<input type="text" name="contact_title" maxlength="50" size="30">
</p>
</form>
</div><!--End addElement div-->
</div><!--End Left div-->
</div> <!--End main div-->
</div><!--End container div-->
</body><!--End body tag-->
答案 0 :(得分:1)
我真的没有看到z-index问题。也许是。我没有测试你的代码。但是,我确实在那里看到float:left;
,它立即引发了一个标志lol。浮动元素会使其折叠。你应该看一下这篇文章,它详细解释了What is a clearfix?
答案 1 :(得分:0)
将z-index: 10; position: relative;
添加到div #Left
,我尝试使用firebug并正常工作。
<div id="Left" style="float:left; width:70%; z-index: 10; position: relative;">
<!-- stuff inside -->
</div>