2011-11-04 5 views
0

код JQuery всплывающее окно и богатый текстовый редактор ...как jquery будет полезно открыть всплывающее окно?

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html> 
<head> 
<title>LIGHTBOX EXAMPLE</title> 
<SCRIPT> 
function clearDefaultandCSS(el) { 
if (el.defaultValue==el.value) el.value = "" 
// If Dynamic Style is supported, clear the style 
if (el.style) el.style.cssText = "" 
} 
</SCRIPT> 
<style> 
.black_overlay{ 
display: none; 
position: absolute; 
top: 0%; 
left: 0%; 
width: 100%; 
height: 100%; 
background-color:#9A9A9C; 
z-index:1001; 
-moz-opacity: 0.8; 
opacity:.80; 
filter: alpha(opacity=80); 
} 
.white_content { 
display: none; 
position: absolute; 
top: 25%; 
left: 25%; 
width: 30%; 
height: 40%; 
background-color: #FFF; 
z-index:1200; 
overflow: auto; 
border-radius: 10px; 
ms-border-radius: 10px; 
right: 25%; 
bottom: 25%; 
padding: 25px; 
} 
.button { 
display: inline-block; 
min-width: 54px; 
text-align: center; 
color: #555; 
font-size: 11px; 
font-weight: bold; 
height: 27px; 
padding: 0 8px; 
line-height: 27px; 
-webkit-border-radius: 5px; 
-moz-border-radius: 5px; 
border-radius: 5px; 
-webkit-transition: all 0.218s; 
-moz-transition: all 0.218s; 
-ms-transition: all 0.218s; 
-o-transition: all 0.218s; 
transition: all 0.218s; 
border: 1px solid gainsboro; 
border: 1px solid rgba(0, 0, 0, 0.1); 
background-color: whiteSmoke; 
background-image: -webkit-gradient(linear,left top,left    bottom,from(#f5f5f5),to(#f1f1f1)); 
background-image: -webkit-linear-gradient(top,#f5f5f5,#f1f1f1); 
background-image: -moz-linear-gradient(top,#f5f5f5,#f1f1f1); 
background-image: -ms-linear-gradient(top,#f5f5f5,#f1f1f1); 
background-image: -o-linear-gradient(top,#f5f5f5,#f1f1f1); 
background-image: linear-gradient(top,#f5f5f5,#f1f1f1); 
-webkit-user-select: none; 
-moz-user-select: none; 
user-select: none; 
cursor: default; 

} 
</style> 
</head> 
<body style="overflow:hidden"> 
<a href = javascript:void(0) onclick = "document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'">Login</a> 
<div id="light" class="white_content" style="overflow:hidden"> 
<div align="justify"> 
<img align="right" src='file:///C|/Users/vptr/Desktop/close.png' onclick = "document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'"> 
</div> 
<p align="left" style="color:#006633; font: Arial, Helvetica, sans-serif, Arial, Helvetica, sans-serif; font-size: xx-large">Log In to <span style="color:#000">Grill</span></p> 

<table> 
<form action="" method="get"> 
<tr> <td colspan="2"><input TYPE="text" 
placeholder="Email/Username" 
style="height:30px; width:200px; color:#0CF" 
ONFOCUS="clearDefaultandCSS(this)"></td> </tr><br> 
<tr> <td colspan="2"><input type="password" 
placeholder="password" 
style="height:30px; width:200px; color:#063"s 
TITLE="password" 
ONFOCUS="clearDefaultandCSS(this)"></td></tr> 
<tr><td><input type="submit" class="button" value="Login"></td><td><p><a href="#"><span style="color:#033">Forgot password</a></p></td></tr> 
</span></form> 
</table> 
<div align="center" ><p>Create an <a href= ><span style="color:#033">Account</span></a>    <p></div> 
</div> 
<div id="fade" class="black_overlay"></div> 
</body> 
</html> 

выше код полезен для создания журнала в всплывающем окне с помощью JQuery.

здесь я использовал скрипт java, чтобы открыть всплывающее окно, я хочу знать, как открывается всплывающее окно.

и с использованием этого же скрипта, как открыть другое всплывающее окно, когда я нажимаю на забыть пароль.

ответ

0

Он исходит из значения onclick. Но это действительно плохой код. У вас есть javascript внутри вашего html, который для разных не очень хорош. вы должны сохранять стиль, код и контент, если это возможно.

<a href = javascript:void(0) onclick = "document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'">Login</a> 

В основном это прямо здесь, он найдет Див , потому что он имеет идентификатор света. Затем он будет блокировать отображение, поскольку по умолчанию он скрыт. Он также покажет фоновое оверлея, чтобы вычеркнуть его. Все это делается с помощью css. Обратите внимание, что div с id light имеет класс white_content. Вот как это оформлено.

честно, если у вас есть jquery и вы хотите его использовать, то почему бы не использовать его. Это просто прямо css и javascript, здесь нет jquery. Вы можете загрузить много плагинов для этого типа вещей.

Взгляните на http://fancybox.net/, это позволит вам легко отделить код от html.

не Если вы хотите сохранить этот код, чтобы создать еще один просто сделать что-то вроде:

<a href = javascript:void(0) onclick = "document.getElementById('newpopup').style.display='block';document.getElementById('fade').style.display='block'">New Popup</a> 

<div id="newpopup" class="white_content" style="overflow:hidden">

Anything you want in here

</div>

0

Прежде всего, это разметка не имеет jQuery в нем.

Show "легкие" & элементы "замирание" на нажатие кнопки "Вход":

<a href=javascript:void(0) 
    onclick="document.getElementById('light').style.display='block'; 
      document.getElementById('fade') .style.display='block'">Login</a>` 

Скрыть "свет" и элементов "замирания" на щелчок тесным образом:

<img align="right" 
    src='file:///C|/Users/vptr/Desktop/close.png' 
    onclick="document.getElementById('light').style.display='none'; 
       document.getElementById('fade') .style.display='none'"> 
Смежные вопросы