| | |
Script Not Working in Other Browser except IE
![]() |
•
•
Join Date: Jun 2009
Posts: 40
Reputation:
Solved Threads: 0
Dear All Experts
I wrote a simple code in javascript and it is working fine with IE but when I open the page in FireFox or in Google Crome it is not working as I expect. Actually I am enabling and disabling the combo box on the on change event of radio button.
Please check the code attached here. And visit my site for output
www.crispwerx.com/catasset
Thanx to all viewer and helper
I wrote a simple code in javascript and it is working fine with IE but when I open the page in FireFox or in Google Crome it is not working as I expect. Actually I am enabling and disabling the combo box on the on change event of radio button.
Please check the code attached here. And visit my site for output
www.crispwerx.com/catasset
Thanx to all viewer and helper
0
#2 Nov 18th, 2009
Hi, there are a few things wrong with your code, it seems like you dont understand the difference between a name and an id. An id is unique, a name is not. You can not retrieve a name with getElementById(). The following code will work in all browsers:
Please note that the names of the selects/checkboxes have changed, so use the following names to retrieve the values:
- $_POST['loginType'] // Admin, storekeeper or user
- $_POST['userDept'] // User department
- $_POST['login'] // Username
- $_POST['password'] // Password
~G
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<?php mysql_connect("localhost", "crispwer_vishal", "vishal@123") or die(mysql_error()); mysql_select_db("crispwer_navy") or die(mysql_error()); $query = "SELECT * FROM depatment"; $result = mysql_query($query); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Login Form</title> <link href="loginmodule.css" rel="stylesheet" type="text/css" /> <script type="text/javascript"> // This function sets the usertype at disabled function sle() { document.getElementById("userDept").disabled=true; } // This function decides whether the usertype should be enabled function ss(niit) { var s = niit; switch(s) { case '1': document.getElementById("userDept").disabled=true; break case '2': document.getElementById("userDept").disabled=true; break case '3': document.getElementById("userDept").disabled=false; break default: document.write("ERROR") } } </script> </head> <body onLoad="sle()"> <p> </p> <form id="loginForm" name="loginForm" method="post" action="userchek.php"> <hr /> <table width="300" border="0" align="center" cellpadding="2" cellspacing="0"> <tr> <td colspan="3"> <input name="loginType" type="radio" id="1" onclick="ss(this.id); return true;';" value="administrator" /> Administrator| <input name="loginType" type="radio" id="2" onclick="ss(this.id); return true;" value="storekeeper" /> Store Keeper | <input name="loginType" type="radio" id="3" onclick="ss(this.id); return true;" value="user" /> User</td> </tr> </tr> <tr> <td colspan="3">User Department <select id="userDept" name="userDept"> <option>Select</option> <?php while($row = mysql_fetch_array($result)) { echo "<option>$row[Dept_Name]</option>"; }?> </select> </td> </tr> <tr> <td width="111"><b>Login</b><td colspan="2"><input name="login" type="text" class="textfield" id="login" /></td> </tr> <tr> <td><b>Password</b></td> <td colspan="2"><br /> <input name="password" type="password" class="textfield" id="password" /> <br /></td> </tr> <tr> <td><input type="submit" name="Submit" onclick="newwindow();" value=" LOGIN " /></td> <td width="97"><input type="submit" name="Submit2" value="Forgot Password" /></td> <td width="80"><input type="submit" name="Submit3" value="New User" /></td> </tr> </table> <hr /> </form> </body> </html>
- $_POST['loginType'] // Admin, storekeeper or user
- $_POST['userDept'] // User department
- $_POST['login'] // Username
- $_POST['password'] // Password
~G
Last edited by Graphix; Nov 18th, 2009 at 11:53 am.
![]() |
Similar Threads
- Ajax script not working on firefox (JavaScript / DHTML / AJAX)
- whois script not working in IE (PHP)
- login script is not working (PHP)
- Script is not working in linux (Shell Scripting)
- Need a script which detects browser version ? (JavaScript / DHTML / AJAX)
- Java script doesn't working on different browser (JavaScript / DHTML / AJAX)
- CGI script gathering browser info (C++)
- Cross-browser script... Not working for Opera... (JSP)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Select List/Menu Help
- Next Thread: help.form page. no inner html
Views: 553 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for JavaScript / DHTML / AJAX
8 acid2 ajax array attributes autocomplete automatically autoplay beta boarder body box boxes browser bug button captcha card cart codes column content css date db debugger decimal design developer div dom download dynamic element enter error events explorer external firefox flash focus form frameworks getselection google gwt html htmlform iframe image index internet java javascript javascripts jquery jsp listbox maps marquee masterpage menu microsoft mimic modal mp4 mysql offline onclick onmouseover parameters php player post print problem programming prototype rating redirect reload safari scale scriptlets search select servlet size sources starrating string toggle validation variables w3c web window windowofwords xml





