JavaScript 및 CSS를 사용하여 iframe
을 사용하여 메시지 대화 상자를 만들려고합니다. 내가 원했던 것은 opacity
이 0.4
인 문서와 보여줄 메시지 상자입니다. 그러나 그 일은 일어나지 않습니다. 어떻게해야합니까?JavaScript -이 코드가 작동하지 않는 이유는 무엇입니까?
내 자바 스크립트
function messageBox(text)
{
document.style.opacity = 0.4;
document.style.filter = 'alpha(opacity=40);';
var box = document.createElement('iframe');
box.setAttribute('id', 'msgBox');
}
내 CSS는
#msgBox
{
position:absolute;
top:0;
left:0;
right:0;
bottom:0;
height: 250px;
width: 350px;
background-color: #CCC;
margin: auto;
z-index:9999;
color:white;
box-shadow:1px 1px 1px 1px #444;
}
가 바이올린을 만들고 확인하시기 바랍니다. – AurA
먼저 DIV로 시도한 다음 iFrame을 사용해보십시오. 문제는 iFrame이 될 수 있습니다 –
직접 디버깅을 시도 했습니까? HTML은 어떤 모습입니까? 어떻게'messageBox'를 호출할까요? 콘솔에 오류가 있습니까? 'messageBox'가 호출되는 것이 확실합니까? –