Я хочу показать всплывающее окно на странице и иметь поле флажка в этом всплывающем окне, я хочу, чтобы эта страница была видна только в том случае, если флажок установлен. Проблема в том, что он хорошо работает на функции щелчка, но не может заставить его работать с флажком. Это мой кодjQuery popup window onload
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var id = '#dialog';
//Get the screen height and width
var maskHeight = $(document).height();
var maskWidth = $(window).width();
//Set heigth and width to mask to fill up the whole screen
$('#mask').css({'width':maskWidth,'height':maskHeight});
//transition effect
$('#mask').fadeIn(1000);
$('#mask').fadeTo("slow",0.8);
//Get the window height and width
var winH = $(window).height();
var winW = $(window).width();
//Set the popup window to center
$(id).css('top', winH/2-$(id).height()/2);
$(id).css('left', winW/2-$(id).width()/2);
//transition effect
$(id).fadeIn(2000);
//if close button is clicked
if ($('.window .close').attr('checked')==true){
function (e) {
//Cancel the link behavior
e.preventDefault();
$('#mask').hide();
$('.window').hide();
}};
//if mask is clicked
$('#mask').click(function() {
$(this).hide();
$('.window').hide();
});
});
</script>
<div style="font-size: 10px; color: rgb(204, 204, 204);">lorem ipsum</div>
<div id="boxes">
<div style="top: 199.5px; left: 551.5px; display: none;" id="dialog" class="window">
Simple Modal Window |
<input type="checkbox" class="close">
</div>
<!-- Mask to cover the whole screen -->
<div style="width: 1478px; height: 602px; display: none; opacity: 0.8;" id="mask"> </div>
</div>
Пожалуйста, напишите краткие примеры, так как это поможет тем, кто отвечает на ваши вопросы. –