Помогите пожалуйста написать скрипт
Помогите написать скрипт=( Работа скрипта заключается в том что:На сайте у каждого пользователя есть кнопка блокировать страницу, суть блокировки это парольная защита данной страницы , т.е по нажатию на кнопку просится ввести пароль , после ввода пароля на страничку накладывается оверлей чтоб его убрать надо ввести пароль.Помогите плиз реализовать это
|
Вы просите готовый скрипт с нуля.
Это работа, и за нее обычно платят деньги. Для таких сообщений предназначен раздел форума "Работа". Если вы все же хотите, чтобы вам помогли - приложите какие-то усилия сами и задавайте вопросы по ходу дела. |
Вот что у меня получилось, оно не так работает как надо:(
<!DOCTYPE HTML> <html> <head> <title>Untitled</title> <meta charset="utf-8" /> <script src="http://code.jquery.com/jquery-latest.js"></script> <CENTER> <body bgColor=#923947 link="#008000" onload="start(document.forms[0])" onunload="cleartids()"> <FONT color="#20ffff"><h3><CENTER></CENTER></h3></FONT color> <SCRIPT LANGUAGE="JavaScript"> <!-- Begin function LogIn(){ loggedin=false; username=""; password=""; addnewusername=""; username=prompt("Name: Primer",""); username=username.toLowerCase(); password=prompt("Password - Primer",""); password=password.toLowerCase(); if (username=="Primer" && password=="Primer") { loggedin=true; window.location="http://localhost/engine/messages/inbox"; } if (username=="Primer2" && password=="Primer2") { loggedin=true; window.location="ndex.html"; } // и так далее... if (loggedin==false) { alert("Неверный пароль или имя пользователя!"); } } // End --> </SCRIPT> </HEAD> <script> jQuery.fn.center = function() { var w = $(window); this.css("position","absolute"); this.css("top",(w.height()-this.height())/2+w.scrollTop() + "px"); this.css("left",(w.width()-this.width())/2+w.scrollLeft() + "px"); return this; } function creatOverlay(){ var docHeight = $(document).height(); $("<div id='overlay'></div>") .appendTo("body") .height(docHeight) .css({ 'opacity': 0.4, 'position': 'fixed', 'top': 0, 'left': 0, 'background-color': 'black', 'width': '100%', 'z-index': 5000 }); $(this).clone().appendTo("body").center().css({'z-index': 5001}).attr({'id' : 'cln'}) } function remov() { $("#overlay, #cln").remove(); } $(document).on({"click": creatOverlay}, "input") $(document).on({"click": remov}, "#overlay, #cln") </script> </head> <body> <BODY> <center> <form><input type=button value="Block This Page" onClick="LogIn()"></form> </center> </BODY> </body> </html> |
Цитата:
|
Цитата:
|
LexLuter,
... ![]()
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script language="JavaScript">
function LogIn(){
loggedin=false;
username="";
password="";
addnewusername="";
username=prompt("Name: Primer","");
//username=username.toLowerCase();
password=prompt("Password - Primer","");
//password=password.toLowerCase();
if (username=="Primer" && password=="Primer") {
loggedin=true;
//window.location="http://localhost/engine/messages/inbox";
}
if (username=="Primer2" && password=="Primer2") {
loggedin=true;
// window.location="ndex.html";
}
// и так далее...
if (loggedin==false) {
alert("Неверный пароль или имя пользователя!");
}
else remov()
}
</script>
<script>
jQuery.fn.center = function () {
var w = $(window);
this.css("position", "absolute");
this.css("top", (w.height() - this.height()) / 2 + w.scrollTop() + "px");
this.css("left", (w.width() - this.width()) / 2 + w.scrollLeft() + "px");
return this;
}
function creatOverlay() {
var docHeight = $(document).height();
$("<div id='overlay'><\/div>")
.appendTo("body")
.height(docHeight)
.css({
'opacity': 0.8,
'position': 'fixed',
'top': 0,
'left': 0,
'background-color': '#000000',
'width': '100%',
'z-index': 5000
})
//$(this).clone()
.appendTo("body").center().css({
'z-index': 5001
})
//.attr({ 'id': 'cln' })
LogIn()
}
function remov() {
$("#overlay, #cln").remove();
}
$(document).on({
"click": creatOverlay
}, "input")
//$(document).on({"click": remov}, "#overlay, #cln")
</script>
</head>
<body bgcolor="#923947">
<center>
<form>
<input type="button" value="Block This Page">
</form>
</center>
</body>
</html>
|
рони Спасибо за помощь:)
|
| Часовой пояс GMT +3, время: 20:49. |