SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2003
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help with piece of code

    In the following piece of code my browser things the less than symbol is an opening html tag. Does anyone Know why this is?. Also I want this script to return false if a user enters a character instead of an int. How do I do this?

    [javascript]
    <script language="javascript">
    function Verify() {


    if ( document.select.tickets.value <= 0 || document.select.tickets.value =="")
    {

    alert("Either you have not requested any tickets, or have entered a 0.");
    return false;
    }


    else {
    document.select.submit();
    return true;
    }
    }
    </script>
    [/javascript]

  2. #2
    SitePoint Guru dale_burrell's Avatar
    Join Date
    Aug 2002
    Location
    Wellington, New Zealand
    Posts
    861
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if you surround you javascript with html comments and surround the html comment with javascript comments as follows (although you shouldn't have to do this unless you have an old browser):
    Code:
    <script><!-- // Loads the frame if someone loads this instead.
    if(parent.location.href == self.location.href) { window.location.href = 'index.html'; }
    //--></script>
    you can try using the parseInt() function to see if the value entered is what you want.
    If you aren't living life on the edge
    - you're taking up too much space
    Creative Dreaming Ltd / Ask The Local / Amanzi Travel


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •