SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Twitter - @CarlBeckel busy's Avatar
    Join Date
    May 2004
    Location
    Richmond, VA, USA
    Posts
    819
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    pointless this.location to process a form?

    Hi, I'm javascript "challenged" and I have a quick question.

    I'm working on a clients site, and I ran across the following code. Is there any reason at all to use javascript here? I'm about to stick that url in action where it belongs, but I wanted to get someone's take who actually works with javascript more than once every 6 months. (That would be me.)
    Code:
    <form method="post" action="" name="logInForm" onsubmit="return login();">
       
       <script>
         function login() {
             this.location.href="https://signin.website.com/page.dll?SignIn&var=SomeParam=site%3Dhttp%3A%2F%2Freferringwebsite%2Ecom%26Xnumber%3D9736769";
             return false;
         }
       </script>
    There had to be SOME reason to do that, right?

  2. #2
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    The only reason I can think of is if the action target address somehow depends on user input elsewhere on the page or on some variable like the user's screen size or plugin availability.

    I don't think it's a very intelligent thing to do. I'd stick it in the action attribute too.

  3. #3
    Twitter - @CarlBeckel busy's Avatar
    Join Date
    May 2004
    Location
    Richmond, VA, USA
    Posts
    819
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the reassurance.

    I had a feeling I'd be running into a lot of stuff like this when I noticed the one swf file on the site was the navigation bar. The code choices and site structure is actually so bad that the job has gone past stress and headache so far that it wrapped all the way around to fun and humorous.

    Except for the copious tables. Those things will always suck (rant finished


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
  •