This is a discussion on problem in javascript within the HTML, CSS and Javascript Coding Techniques forums, part of the Web Development category; <script language="Javascript"> function submitForm(action) { document.all.formlogin. innerHTML = document.all.formlogin.innerHTML + "<...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| <script language="Javascript"> function submitForm(action) { document.all.formlogin. innerHTML = document.all.formlogin.innerHTML + "<input type=hidden name=statusx value=" + action + ">"; document.formlogin. submit(); } </script> <form name = "formlogin" action = "index.php" method = "POST"> UserName: <input type = "text" name = "UserName"></br></br> PassWord: <input type = "password" name = "PassWord"></br></br> <a class = "login" href="javascript: submitForm(\'temp\');"> Temporary Login</a></br> <a class = "login" href="javascript: submitForm(\'perm\');"> Permanent Login</a> </form> I made such code, but once I click any of login links, my $_POST array has only statusx value, but not UserName and PassWord. What should I change?
__________________ web design company |
| Sponsored Links |
| |||
| Hi, The way you had done(for adding hidden field to the form dynamically) in the submitForm function is not a good approach. If you want to add an element dynamically means go by DOM approach. Here in your case, it is also not needed. From your logic, i understood that the one value passing to the JS function from that it will stored in dynamic hidden field and submitting the form. Instead of going for dynamic hidden field, make that hidden field in the form itself and set the value dynamically to the hidden field by JS Function and submit the form, you will get the result[Its a Simple One, I think]. And finally, you didnt have the chance to face the browser compatibility(i think). Because, You had written document.all for getting the values. document.all is supported in IE Browser only not in firefox, safari etc., So, you have to take a look for these issues also.
__________________ Regards, VELHARI I am not totally useless. I can be used for a bad example |
| |||
| ok buddy. Whatever u say i will give attention but u said Quote:
i didn't understand.
__________________ web design company |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| a new problem? | saravanan | Computer Hardware | 0 | 03-24-2008 06:09 AM |
| Problem in IE | krishnakumar | HTML, CSS and Javascript Coding Techniques | 13 | 11-28-2007 08:51 PM |
| How does JavaScript Reporter differ from JavaScript editors? | Pvinothkumar | HTML, CSS and Javascript Coding Techniques | 1 | 09-13-2007 04:59 AM |
| Problem on .net 3.0 WPF! | theone | C# Programming | 0 | 07-19-2007 09:56 PM |
| DNS problem | vadivelanvaidyanathan | Server Management | 0 | 07-15-2007 05:49 PM |