PDA

View Full Version : browser cannot find the function even though it is present...help



pritamdulam
10-06-2010, 11:38 AM
HI,

I have written following code.... The problem is that onmousemoveover is not working..

the error console shows...

"login is not a function" line 1...
plz help...



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Home</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-5" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<style type="text/css">
#popupbox{
margin: 0;
margin-left: 0; /* This gets it relatively center on the screen */
margin-right: 0; /* This gets it relatively center on the screen */
margin-top: 10px; /* Makes it a little off the top of the screen */
padding-top: 10px; /* Make the text not touching the top on the login box */
width: 20%; /* For centering it on the screen */
height: 150px; /* The height of the login box */
position: absolute; /* Makes sure its absolute so it doesn't dock with everything else */
background: #CCCCCC; /* Login Box background color. Change this if desired. */
border: solid #000000 2px; /* Makes a black border around the login box */
z-index: 9; /* Makes it on top of everything else */
font-family: arial; /* Sets the font */
visibility: hidden; /* Makes it hidden at first. Very Important.*/
}
</style>
<script language="JavaScript" type="text/javascript">
function login(showhide){
if(showhide == "show"){
document.getElementById('popupbox').style.visibility="visible"; /* If the function is called with the variable 'show', show the login box */
}else if(showhide == "hide"){
document.getElementById('popupbox').style.visibility="hidden"; /* If the function is called with the variable 'hide', hide the login box */
}
}
</script>
</head>
<body>
<strong><a href="javascript:login('show');" onMouseOver="login('show');" style="color:#807F7F;text-decoration:none;">Customer Login</a></strong>
<div id="popupbox"> <!--Start login box-->
<form name="login" action="./lib/checkLogin.php" method="post">
<center>Username:</center>

<center><input name="txt_username" size="14" /></center>
<center>Password:</center>
<center><input name="txt_password" type="password" size="14" /></center>
<center><input type="submit" name="submit" value="login" /></center>
</form>
<br />
<strong><center><a href="javascript:login('hide');" style="color:#807F7F;text-decoration:none;">close</a></center></strong> <!-- Closes the box-->

</div> <!--End login box-->

</body>
</html>



plz help...

vwphillips
10-06-2010, 07:46 PM
you have a function named login and a form named login,

change one and it works


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Home</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-5" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<style type="text/css">
#popupbox{
margin: 0;
margin-left: 0; /* This gets it relatively center on the screen */
margin-right: 0; /* This gets it relatively center on the screen */
margin-top: 10px; /* Makes it a little off the top of the screen */
padding-top: 10px; /* Make the text not touching the top on the login box */
width: 20%; /* For centering it on the screen */
height: 150px; /* The height of the login box */
position: absolute; /* Makes sure its absolute so it doesn't dock with everything else */
background: #CCCCCC; /* Login Box background color. Change this if desired. */
border: solid #000000 2px; /* Makes a black border around the login box */
z-index: 9; /* Makes it on top of everything else */
font-family: arial; /* Sets the font */
visibility: hidden; /* Makes it hidden at first. Very Important.*/
}
</style>
<script language="JavaScript" type="text/javascript">
function login1(showhide){
if(showhide == "show"){
document.getElementById('popupbox').style.visibility="visible"; /* If the function is called with the variable 'show', show the login box */
}else if(showhide == "hide"){
document.getElementById('popupbox').style.visibility="hidden"; /* If the function is called with the variable 'hide', hide the login box */
}
}
</script>
</head>
<body>
<strong><a href="javascript:login('show');" onMouseOver="login1('show');" style="color:#807F7F;text-decoration:none;">Customer Login</a></strong>
<div id="popupbox"> <!--Start login box-->
<form name="login" action="./lib/checkLogin.php" method="post">
<center>Username:</center>

<center><input name="txt_username" size="14" /></center>
<center>Password:</center>
<center><input name="txt_password" type="password" size="14" /></center>
<center><input type="submit" name="submit" value="login" /></center>
</form>
<br />
<strong><center><a href="javascript:login('hide');" style="color:#807F7F;text-decoration:none;">close</a></center></strong> <!-- Closes the box-->

</div> <!--End login box-->

</body>
</html>

pritamdulam
10-07-2010, 09:58 AM
Thanks its solved..........