Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Oct 2006
    Posts
    164
    Thanks
    5
    Thanked 0 Times in 0 Posts

    OnClick and XHTML issue

    Hello, Ummm i know almost nothing about JS because i dont use it, and thus never learned it. So, im recoding this site to be valid xhtml and i need to remove "name=\"loginform\"" from the form but "onclick=\"document.loginform.submit();\"" uses it to work. How do I fix the onclick to work without the name attribute?

    Code:
                 <form name=\"loginform\" id=\"login\" action=\"clients/dologin.php?goto=clientarea\" method=\"post\">";##edit action="" to match your whmcs dir
                 echo "
                    <p><input name=\"username\" type=\"text\" class=\"logintext\" value=\"Email Address\" onfocus=\"if (this.value=='Email Address')this.value='';\" onblur=\"if (this.value=='')this.value='Email Address'\" />
                    <input name=\"password\" type=\"password\" class=\"logintext\" value=\"Password\" onfocus=\"if (this.value=='Password')this.value='';\" onblur=\"if (this.value=='')this.value='Password'\" />
                    <input type=\"submit\" value=\"Login\" style=\"display:none;\" />
                    <img class=\"submit\" src=\"images/loginbuttonbg.jpg\" alt=\"Login\" width=\"36\" height=\"28\" id=\"Image1\" onclick=\"document.loginform.submit();\" onmouseover=\"MM_swapImage('Image1','','images/loginhover.jpg',1)\" onmouseout=\"MM_swapImgRestore()\" /></p>
                </form>
    Thank You.
    Not much, but its something.

  • #2
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,621
    Thanks
    0
    Thanked 645 Times in 635 Posts
    document.getElementById('login').submit();
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #3
    Regular Coder
    Join Date
    Oct 2006
    Posts
    164
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Great! Thank you very much!
    Not much, but its something.


  •  

    Posting Permissions

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