hi all,

i am new to javascript
i was trying to passe text input to javascript. but code is not working here is the code

<script type="text/javascript">
function val(){
  if(document.a.email.value=="" ||document.a.email.value==null ){
    return false;
    if(document.a.email.value!="" ||document.a.email.value!=null ){
   return true;

and here is the HTML code,

<form action="a.php" method="POST" onsubmit="return val();">
        <strong>E-Mail Address</strong> *</td><td><input name="email" type="text" value="" />
        <input type="submit" value="submit"  />

can anybody tell me the reason not to view the alert message..

and i want if the email is null to stop submiting the data to a.php

you forgot to give name and id to form. Here is proper code.

<form name='a' id='a' action="a.php" method="POST" onsubmit="return val();">
if(document.a.email.value!="" ||document.a.email.value!=null )

That condition is always true - you should AND any NOT conditions in general.

also you can probably pass the this keyword to return val() and use that in your function for portability.