gpt4 book ai didi

javascript - "Popup"的 CSS 在 FireFox 中不工作

转载 作者:行者123 更新时间:2023-11-28 14:48:28 24 4
gpt4 key购买 nike

我在网上找到了一些使用 div 和 CSS opacity 属性在 CSS 中执行“弹出”表单的代码。它适用于 IE 和 Chrome,但不适用于 FireFox。在 FireFox 中,没有任何反应。我在董事会上看到了 FireFox CSS 的一些问题,但没有什么是我所看到的。在这个问题上的任何帮助都会很棒,因为我是 CSS 的新手。谢谢!

[此处][1] 是我获取代码以供引用的站点。

CSS

        #blanket
{
background-color: #111;
opacity: 0.65;
filter: alpha(opacity=65);
position: absolute;
z-index: 9001;
top: 0px;
left: 0px;
width: 100%;
}
#popUpDiv
{
position: absolute;
background-color: #eeeeee;
width: 300px;
height: 300px;
z-index: 9002;
}

HTML:

<td align="left">
<div id="blanket" style="display: none;">
</div>
<div id="popUpDiv" style="display: none;">
<table>
<tr>
<td>
<a href="#" onclick="popup('popUpDiv')">Close</a>
</td>
</tr>
<tr>
<td style="color: Black;">
Please describe the issue:
</td>
</tr>
<tr>
<td>
<asp:TextBox ID="txtIssue" runat="server" TextMode="MultiLine" Width="275" Height="200"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Button ID="cmdSend" runat="server" Text="Send" />
</td>
</tr>
</table>
</div>
<a href="#" onclick="popup('popUpDiv')">Click here to report an issue.</a>
<br />
<asp:Label ID="lblIssueStatus" runat="server" Text="" Style="color: Red;"></asp:Label>
</td>

JS:

 function toggle(div_id) {
var el = document.getElementById(div_id);
if ( el.style.display == 'none' ) { el.style.display = 'block';}
else {el.style.display = 'none';}
}

function blanket_size(popUpDivVar) {
if (typeof window.innerWidth != 'undefined') {
viewportheight = window.innerHeight;
} else {
viewportheight = document.documentElement.clientHeight;
}
if ((viewportheight > document.body.parentNode.scrollHeight) && (viewportheight > document.body.parentNode.clientHeight)) {
blanket_height = viewportheight;
} else {
if (document.body.parentNode.clientHeight > document.body.parentNode.scrollHeight) {
blanket_height = document.body.parentNode.clientHeight;
} else {
blanket_height = document.body.parentNode.scrollHeight;
}
}
var blanket = document.getElementById('blanket');
blanket.style.height = blanket_height + 'px';
var popUpDiv = document.getElementById(popUpDivVar);
popUpDiv_height=blanket_height/2-150;//150 is half popup's height
popUpDiv.style.top = popUpDiv_height + 'px';
}

function window_pos(popUpDivVar) {
if (typeof window.innerWidth != 'undefined') {
viewportwidth = window.innerHeight;
} else {
viewportwidth = document.documentElement.clientHeight;
}
if ((viewportwidth > document.body.parentNode.scrollWidth) && (viewportwidth > document.body.parentNode.clientWidth)) {
window_width = viewportwidth;
} else {
if (document.body.parentNode.clientWidth > document.body.parentNode.scrollWidth) {
window_width = document.body.parentNode.clientWidth;
} else {
window_width = document.body.parentNode.scrollWidth;
}
}
var popUpDiv = document.getElementById(popUpDivVar);
window_width=window_width/2-150;//150 is half popup's width
popUpDiv.style.left = window_width + 'px';
}

function popup(windowname) {
blanket_size(windowname);
window_pos(windowname);
toggle('blanket');
toggle(windowname);
}

最佳答案

看起来我的脚本类型标签是 jscript,我的愚蠢错误。感谢大家的帮助!

关于javascript - "Popup"的 CSS 在 FireFox 中不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4970573/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com