Buenas, soy principiante en html y php.
Estuve siguiendo un tutorial para una pequeñísima aplicación php en netbeans y tengo un error el cual no puedo solucionar.
Tal como lo menciono en el título de este post:
Linea 3
Car 9
error: 'document.all.entrar.style.visibility' es nulo o no es un objeto
código 0
El error se produce al hacer clic en el botón "My WishList >>"
Mi código es el siguiente:
Código:
<?php
require_once("Includes/db.php");
$logonSuccess = true;
if ($_SERVER["REQUEST_METHOD"] == "POST"){
if (WishDB::getInstance()->verify_wisher_credentials($_POST["user"], $_POST["userpassword"]) == 1) {
session_start();
$_SESSION["user"] = $_POST["user"];
header('Location: editWishList.php');
} else {
$logonSuccess = false;
}
}
?>
<script type="text/javascript">
function showHideLogonForm() {
if (document.all.entrar.style.visibility == "visible"){
document.all.entrar.style.visibility = "hidden";
document.all.myWishList.value = "Mostrar...";
}
else {
document.all.entrar.style.visibility = "visible";
document.all.myWishList.value = "Ocultar";
}
}
function showHideShowWishListForm() {
if (document.all.wishList.style.visibility == "visible") {
document.all.wishList.style.visibility = "hidden";
document.all.showWishList.value = "Mostrar...";
}
else {
document.all.wishList.style.visibility = "visible";
document.all.showWishList.value = "Ocultar";
}
}
</script>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Wish List Application</title>
<link href="wishlist.css" type="text/css" rel="stylesheet" media="all" />
</head>
<body>
<div id="contenidos">
<div id="encabezado">
<h1>My Wish List</h1>
</div>
<div id="principal">
In this tutorial, you use the PHP support in the NetBeans IDE to create and run a siCSS style sheet in Lesson 8. Finally, you will deploy the application on a remote web server using the hints given in lesson 9.
</div>
<div id="entrar">
<input type="submit" name="myWishList" value="My Wish List >>" onclick="javascript:showHideLogonForm()"/>
<form name="entrar" action="index.php" method="POST" style="visibility:<?php if ($logonSuccess) echo "hidden"; else echo "visible";?>">
Username: <input type="text" name="user"/>
Password: <input type="password" name="userpassword"/><br/>
<div class="error">
<?php
if (!$logonSuccess)
echo "Invalid name and/or password";
?>
</div>
<input type="submit" value="Edit My Wish List"/>
</form>
</div>
<div id="showWishList">
<input type="submit" name="showWishList" value="Show Wish List of >>" onclick="javascript:showHideShowWishListForm()"/>
<form name="wishList" action="wishlist.php" method="GET" style="visibility:hidden">
<input type="text" name="user"/>
<input type="submit" value="Go" />
</form>
</div>
<div id="createWishList">
Still don't have a wish list?! <a href="createNewWisher.php">Create now</a>
</div>
</div>
</body>
</html>