hi friends i want to apply javascript on the the go-btn so if i do give wrong password the alert box should pop up itryed but i didnt figure it out....please help me out..

below is the code

<!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=utf-8" />


<script language="javascript" type="text/javascript">
function button(){
    var user =document.getElementById("go-btn").value;
    if($password!="amry")
alert('You are very brave!');
else alert('A wise decision!')
</script>
<title>Login</title>
<link rel="stylesheet" type="text/css" href="1css/css.css" />
<style type="text/css">
<!--

#image{


        margin-top: 7px;
}


#images{

font-family: fantasy;
    font-size: 8px; 

}
-->
</style></head>

<body >

    <div class="login-form">
        <div id="hedding">
            <div class="left"></div>
            <div class="main">
                <div class="text">
                    <span class="heding-txt1">LOGIN AREA</span>
                    <span class="heding-txt2">FOR</span>
                    <span class="heding-txt3">ZMS</span>
                </div>

            </div>
            <div class="right"></div>
        </div>


        </div>
        <div class="enter">

            <div class="form-lft"></div>
            <div class="form-main">
                <div class="inner-form">
                <form action="logindb.php" method="POST" >
                    <label>Username</label>
                    <input type="text" class="input" name="name" />
                    <label>Password</label>
                    <input type="password" class="input" name="password" />
                </div>
                <div class="buttns">

               /////////// here is the go btn /////////////////
                    [ICODE]<input type="submit"  class="go-btn" value=""  onclick="button()"/>[/ICODE]
                    <input type="submit" class="lost-btn" value="" />
                </div>
                </form></div>
            <div class="form-rght"></div>

        </div>
    </div>   



</body>
<div id="image"><center><img src="222071_1941814027700_1312940202_2218448_386665_n.jpg"/></center>
</div>
<div id="images"><center>Developed by AMRY Soft</center></div>
</html>

You just see following line number in my code
10,14,15,18,64,66,68,73

problems
You have not closed your function {}
you are using $password in javascript
you are calling getelementbyID, but you have not set id for your form, name, password element


Also you must ignore using standard html attributes names as name and ID of your elements

<!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=utf-8" />


<script language="javascript" type="text/javascript">
function button1(){
	var user =document.getElementById("go-btn").value;
	if(document.getElementById("password").value!="amry")
alert('You are very brave!');
else 
{
  alert('A wise decision!')
document.getElementById("frm").submit();

}
}
</script>
<title>Login</title>
<link rel="stylesheet" type="text/css" href="1css/css.css" />
<style type="text/css">
<!--

#image{
	
	
	    margin-top: 7px;
}


#images{
	
font-family: fantasy;
    font-size: 8px;	
	
}
-->
</style></head>

<body >

	<div class="login-form">
    	<div id="hedding">
        	<div class="left"></div>
            <div class="main">
            	<div class="text">
                    <span class="heding-txt1">LOGIN AREA</span>
                    <span class="heding-txt2">FOR</span>
                    <span class="heding-txt3">ZMS</span>
                </div>
                
            </div>
            <div class="right"></div>
        </div>
        
            
        </div>
        <div class="enter">
        
        	<div class="form-lft"></div>
            <div class="form-main">
            	<div class="inner-form">
                <form name=frm id=frm action="logindb.php" method="POST" >
                    <label>Username</label>
                    <input type="text" class="input" name="name" id=name/>
                    <label>Password</label>
                    <input type="password" class="input" name="password" id=password />
                </div>
                <div class="buttns">

               /////////// here is the go btn /////////////////
                	 <input type="button"  class="go-btn" value="go-btn" id="go-btn"  onclick="javascript:button1()"/>
                     <input type="submit" class="lost-btn" value="go-btn" id="lost-btn" />
                </div>
                </form></div>
			<div class="form-rght"></div>
        
        </div>
    </div>	
        
        
        
</body>
<div id="image"><center><img src="222071_1941814027700_1312940202_2218448_386665_n.jpg"/></center>
</div>
<div id="images"><center>Developed by AMRY Soft</center></div>
</html>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.