Показать сообщение отдельно

  #232  
Старый 29.12.2007, 03:21
astrologer
Постоянный
Регистрация: 30.08.2007
Сообщений: 773
Провел на форуме:
3069349

Репутация: 808


По умолчанию

Зачем алёрт в тэге ссылки?
php:
PHP код:
if(empty($mess))
{
echo
'<script type="text/javascript">
alert("Вы не ввели сообщение!");
document.location.href = "http://ya.ru";
</script>'
;

js:
Код:
<html>
<head>

<script type="text/javascript">

function check_form(f)
{
  if(f.elements[0].value == '')
  {
    alert('Вы не ввели сообщение');
    document.location.href = 'http://ya.ru';
    return false;
  }
  return true;
}

</script>


</head>
<body>
<form onsubmit="return check_form(this);">
  <textarea></textarea>
  <input type="submit">
</form>
</body>
</html>
 
Ответить с цитированием