Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Bryan Craig
1,388 PointsTrouble with form entry
I am having trouble with my form taking input. I programed the login form to appear when clicked and to disapper when mouseover title or if click another div. Here is the code.
<!DOCTYPE html>
<html>
<head>
<title>Modern Trunk</title>
<link rel="stylesheet" href="style.css" type="text/css">
<link href='http://fonts.googleapis.com/css?family=Poiret+One' rel='stylesheet' type='text/css'>
<link href="webfonts/ss-standard.css" rel="stylesheet" />
</head>
<body>
<div id="wrapper">
<div class="nav">
<div id="logo"><h2><a href="home.html">theModernTrunk</a></h2></div>
<div id="list">
<ul>
<li><a href="#">About</a></li>
<li><a href="#">Team</a></li>
<li><a href="#">Contact</a></li>
<li><a href="#">Policy</a></li>
</ul>
</div>
</div>
</div>
<div id="title" onmouseover="designer(); merchant(); trend();">Welcome to the Modern Trunk</div>
<div id="left" onclick="designerLogin(); merchant(); trend();">
<img src="img/home/designer.jpg" alt="#" />
<h2>DESIGNER</h2>
</div>
<div id="right" onclick="merchantLogin(); designer(); trend();">
<img src="img/home/boutique.jpg" alt="#" />
<h2>MERCHANTS</h2>
</div>
<div id="middle" onclick="trendLogin(); designer(); merchant();">
<img src="img/home/trend.jpg" alt="#" />
<h2>TRENDSETTERS</h2>
</div>
<script type="text/javascript" >
function designer() {
var div = document.getElementById("left");
div.innerHTML= '<img src="img/home/designer.jpg" alt="#" /><h2>DESIGNERS</h2>';
}
function designerLogin() {
var div = document.getElementById("left");
div.innerHTML= '<form method="post" action="contact.php"><table><tr><th><label for="email">Email:</label></th><td><input id="email" type="text" name="email"></td></tr><tr><th><label for="password">Password:</label></th><td><input id="password" type="password" name="password"></td></tr></table><input id="login" type="submit" value="Login"> <input id="register" type="submit" value="or REGISTER"> </form>';
}
function merchant() {
var div = document.getElementById("right");
div.innerHTML= '<img src="img/home/boutique.jpg" alt="#" /><h2>MERCHANTS</h2>';
}
function merchantLogin() {
var div = document.getElementById("right");
div.innerHTML= '<form method="post" action="contact.php"><table><tr><th><label for="email">Email:</label></th><td><input id="email" type="text" name="email"></td></tr><tr><th><label for="password">Password:</label></th><td><input id="password" type="password" name="password"></td></tr></table><input id="login" type="submit" value="Login"> <input id="register" type="submit" value="or REGISTER"> </form>';
}
function trend() {
var div = document.getElementById("middle");
div.innerHTML= '<img src="img/home/trend.jpg" alt="#" /><h2>TRENDSETTERS</h2>';
}
function trendLogin() {
var div = document.getElementById("middle");
div.innerHTML= '<form method="post" action="contact.php"><table><tr><th><label for="email">Email:</label></th><td><input id="email" type="text" name="email"></td></tr><tr><th><label for="password">Password:</label></th><td><input id="password" type="password" name="password"></td></tr></table><input id="login" type="submit" value="Login"> <input id="register" type="submit" value="or REGISTER"> </form>';
}
</script>
</body>
</html>
2 Answers
Bryan Craig
1,388 PointsAny help would be much appreciated. Thanks!