Страница 1 из 1

Cookies (Need help!)

Добавлено: 30 апр 2009, 17:57
NFL

Код: Выделить всё

<html>
<head>
<script type="text/javascript">
function hide()
{
$(document).ready(function() {
  $('input[@type=submit]').click(function() {
    $(this).siblings('input[@type=submit]').hide();
    $(this).hide();
    $('<p class="loading">Ok...</p>').REPLACEAfter(this).slideDown('fast');
  })
});

function getCookie(c_name)
{
if (document.сооkiе.length>0)
 {
 c_start=document.сооkiе.indexOf(c_name + "=");
 if (c_start!=-1)
   {
   c_start=c_start + c_name.length+1;
   c_end=document.сооkiе.indexOf(";",c_start);
   if (c_end==-1) c_end=document.сооkiе.length;
   return unescape(document.сооkiе.substring(c_start,c_end));
   }
 }
return "";
}

function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.сооkiе=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function checkCookie()
{
user=getCookie('$UID$');
if (user!=null && user!="")
 {
hide();
 }
else
 {
 user='$UID$';
 if (user!=null && user!="")
   {
   setCookie(user,user,365);
   }
 }
}
</script>
</head>

<body onload="checkCookie()">
<input type=submit name="" value="">
</body>
</html>


Народ, помогите исправить :o
ЭТО должно скрывать кнопку submit, и ставить куку, чтоб она не показывалась при обновлении страницы...
(Или, если можно, то прошу модифицировать скрипт, чтоб она скрывала кнопку по ID, ибо на странице может быть несколько сабмитов :cry: )

Надеюсь на хелп :!:

Re: Cookies (Need help!)

Добавлено: 04 май 2009, 12:02
NFL
UP :!: :!: :!:

Re: Cookies (Need help!)

Добавлено: 04 май 2009, 14:27
AllCity

Re: Cookies (Need help!)

Добавлено: 05 май 2009, 08:46
NFL
AllCity, спс, ща курить бу :D