標籤:style http java color width os
iframe.html頁面
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>彈窗顯示</title>
</head>
<body>
<div id="container" style="overflow:hidden;">
<iframe border="0" id="content" src="demo1.html" frameborder="0" height="100%" width="100%"></iframe>
</div>
</body>
</html>
//彈出可移動層頁面,以及部分jquery判斷
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>login</title>
<link rel="stylesheet" href="loginDialog.css" type="text/css"/>
<script type="text/javascript" src="../js/jquery-1.8.3.js"></script>
</head>
<body>
<a href="#" id="example">登入DIY帳號視窗樣本</a>
<div id="LoginBox">
<div class="row1">
登入DIY帳號視窗<a href="javascript:void(0)" title="關閉視窗" class="close_btn" id="closeBtn">×</a>
</div>
<div class="row">
使用者名稱: <span class="inputBox">
<input type="text" id="txtName" placeholder="帳號/郵箱" />
</span><a href="javascript:void(0)" title="提示" class="warning" id="warn">*</a>
</div>
<div class="row">
密 碼: <span class="inputBox">
<input type="text" id="txtPwd" placeholder="密碼" />
</span><a href="javascript:void(0)" title="提示" class="warning" id="warn2">*</a>
</div>
<div class="row">
<a href="#" id="loginbtn">登入</a>
</div>
</div>
<script type="text/javascript">
$(function ($) {
//彈出登入
$("#example").hover(function () {
$(this).stop().animate({
opacity: ‘1‘
}, 600);
}, function () {
$(this).stop().animate({
opacity: ‘0.6‘
}, 1000);
})
$("#example").click(function(){
$("body").append("<div id=‘mask‘></div>");
$("#mask").addClass("mask").fadeIn("slow");
$("#LoginBox").fadeIn("slow");
});
//
//按鈕的透明度
$("#loginbtn").hover(function () {
$(this).stop().animate({
opacity: ‘1‘
}, 600);
}, function () {
$(this).stop().animate({
opacity: ‘0.8‘
}, 1000);
});
//文字框不允許為空白---按鈕觸發
$("#loginbtn").click(function () {
var txtName = $("#txtName").val();
var txtPwd = $("#txtPwd").val();
if (txtName == "" || txtName == undefined || txtName == null) {
if (txtPwd == "" || txtPwd == undefined || txtPwd == null) {
$(".warning").css({ display: ‘block‘ });
}
else {
$("#warn").css({ display: ‘block‘ });
$("#warn2").css({ display: ‘none‘ });
}
}
else {
if (txtPwd == "" || txtPwd == undefined || txtPwd == null) {
$("#warn").css({ display: ‘none‘ });
$(".warn2").css({ display: ‘block‘ });
}
else {
$(".warning").css({ display: ‘none‘ });
}
}
});
});
</script>
<script type="text/javascript">
$(document).ready(function(){
$("#txtName").focus(function () {
$("#warn").css({ display: ‘none‘ });
});
$("#txtPwd").focus(function () {
$("#warn2").css({ display: ‘none‘ });
});
//關閉
$(".close_btn").hover(function () { $(this).css({ color: ‘black‘ }) }, function () { $(this).css({ color: ‘#999‘ }) }).click(function () {
$("#LoginBox").fadeOut("fast");
$("#mask").css({ display: ‘none‘ });
});
$("#loginbtn").on("click",function(){
var checkName = false;
var checkPass=false;
var textName,textPass;
textname = $("#txtName").val();
textpass = $("#txtPwd").val();
//文字框不允許為空白---單個文本觸發
var txtName = $("#txtName").val();
if (txtName == "" || txtName == undefined || txtName == null) {
$("#warn").css({ display: ‘block‘ });
}
else {
$("#warn").css({ display: ‘none‘ });
checkName=true;
}
//密碼
var txtName = $("#txtPwd").val();
if (txtName == "" || txtName == undefined || txtName == null) {
$("#warn2").css({ display: ‘block‘ });
}
else {
$("#warn2").css({ display: ‘none‘ });
checkPass = true;
}
if(checkName === false){
alert(‘請輸入使用者名稱‘);
return;
}
if(checkPass === false){
alert(‘請輸入密碼‘);
return;
}
if(checkName===true & checkPass ===true){
$.post("checkLogin.php", { ‘txtname‘:textname, ‘txtpwd‘: textpass},function(data){
alert(data);
});
}
});
$(‘#LoginBox‘).mousemove( function (event) {
var isMove = true;
var abs_x = event.pageX - $(‘#LoginBox‘).offset().left;
var abs_y = event.pageY - $(‘#LoginBox‘).offset().top;
$(document).mousemove(function (event) {
if (isMove) {
var obj = $(‘#LoginBox‘);
obj.css({‘left‘:event.pageX - abs_x, ‘top‘:event.pageY - abs_y});
}
} ).click(function(){
isMove = false;
});
});
});
</script>
</body>
</html>