要求在css和js下解决不知有没可能??
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>无标题文档</title><style>body{ margin: 0px; padding: 0px;}#box{ margin-top: 500px; margin-left: 200px;}#top{ margin-top: 100px; margin-left: 300px;}#bottom{ margin-top: 1240px; margin-left: 300px;}#sig{ height: 20px; width: 90px; margin-left: 100px; margin-top: 100px; background-color: #0066FF; font-weight: bold; color: #FFFFFF;}#ajax{ background-color: #CCCCCC; position: absolute; z-index: 9999; left: 0px; top: 0px; right: 0px; bottom: 0px;}</style></head><body><div onclick="ec()" id="sig">点击注册</div><div id="top">求这能看到(要求灰色背景在的前提下)</div><div id="box">求这能看到(要求灰色背景在的前提下)</div><div id="bottom">求这也能看到</div></body><script>function $(x){ return document.getElementById(x);}function ec() {if($('ajax')){$('ajax').parentNode.removeChild($('ajax'));} var div = document.createElement("div") div.setAttribute("id", "ajax"); div.style.height =document.body.clientHeight+"px"; //定位 div.style.width =document.body.clientWidth+"px"; document.body.appendChild(div); $('ajax').innerHTML="<b>aaaaaaaaaaaaaaaa </b>" }</script></html>
回复讨论(解决方案)
方法一
使用
opacity
filter
确实有遮罩的效果,即 页面的button click不能触发
产生的问题是, 遮罩层上的文字也会产生透明的效果
#ajax{ background-color: #CCCCCC; position: absolute; z-index: 9999; left: 0px; top: 0px; right: 0px; bottom: 0px; opacity:.4; filter:alpha(opacity=40); }
方法2
使用 rgba + 渐变滤镜
ie下 遮罩不成功, button可以触发事件
但文字没有被影响为透明的。
#ajax{ background-color: #CCCCCC; position: absolute; z-index: 9999; left: 0px; top: 0px; right: 0px; bottom: 0px; background-color:rgba(0,0,0,.4); filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#4c000000', EndColorStr='#4c000000');}
可以用两个层来做,
弄个背景遮罩层,设置为透明,再弄个内容层,显示具体的内容。
div.style.height =document.body.clientHeight+"px"; //定位
div.style.width =document.body.clientWidth+"px";
div.style.filter = "alpha(opacity=50)"; //IE
div.style.opacity = ".50"; //chromeium
document.body.appendChild(div);
$('ajax').innerHTML="aaaaaaaaaaaaaaaa "

WebDevelovermentReliesonHtml,CSS和JavaScript:1)HTMLStructuresContent,2)CSSStyleSIT和3)JavaScriptAddSstractivity,形成thebasisofmodernWebemodernWebExexperiences。

HTML的作用是通过标签和属性定义网页的结构和内容。1.HTML通过到、等标签组织内容,使其易于阅读和理解。2.使用语义化标签如、等增强可访问性和SEO。3.优化HTML代码可以提高网页加载速度和用户体验。

htmlisaspecifictypefodyfocusedonstructuringwebcontent,而“代码” badlyLyCludEslanguagesLikeLikejavascriptandPytyPythonForFunctionality.1)htmldefineswebpagertuctureduseTags.2)“代码”代码“ code” code code code codeSpassSesseseseseseseseAwiderRangeLangeLangeforLageforLogageforLogicIctInterract

HTML、CSS和JavaScript是Web开发的三大支柱。1.HTML定义网页结构,使用标签如、等。2.CSS控制网页样式,使用选择器和属性如color、font-size等。3.JavaScript实现动态效果和交互,通过事件监听和DOM操作。

HTML定义网页结构,CSS负责样式和布局,JavaScript赋予动态交互。三者在网页开发中各司其职,共同构建丰富多彩的网站。

HTML适合初学者学习,因为它简单易学且能快速看到成果。1)HTML的学习曲线平缓,易于上手。2)只需掌握基本标签即可开始创建网页。3)灵活性高,可与CSS和JavaScript结合使用。4)丰富的学习资源和现代工具支持学习过程。

AnexampleOfAstartingTaginHtmlis,beginSaparagraph.startingTagSareEssentialInhtmlastheyInitiateEllements,defiteTheeTheErtypes,andarecrucialforsstructuringwebpages wepages webpages andConstructingthedom。

如何设计菜单中的虚线分割效果?在设计菜单时,菜名和价格的左右对齐通常不难实现,但中间的虚线或点如何...


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章

热工具

Atom编辑器mac版下载
最流行的的开源编辑器

ZendStudio 13.5.1 Mac
功能强大的PHP集成开发环境

DVWA
Damn Vulnerable Web App (DVWA) 是一个PHP/MySQL的Web应用程序,非常容易受到攻击。它的主要目标是成为安全专业人员在合法环境中测试自己的技能和工具的辅助工具,帮助Web开发人员更好地理解保护Web应用程序的过程,并帮助教师/学生在课堂环境中教授/学习Web应用程序安全。DVWA的目标是通过简单直接的界面练习一些最常见的Web漏洞,难度各不相同。请注意,该软件中

WebStorm Mac版
好用的JavaScript开发工具

安全考试浏览器
Safe Exam Browser是一个安全的浏览器环境,用于安全地进行在线考试。该软件将任何计算机变成一个安全的工作站。它控制对任何实用工具的访问,并防止学生使用未经授权的资源。