Originariamente inviato da coteaz
nessuno mi aiuta?
Come base da sviluppare:
codice:
<!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>
<style type="text/css">
div#alert {
width:200px;
height:150px;
position:absolute;
visibility:hidden;
z-index: 100;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #FF0000;
background-color: #FFFF55;
border-top: 2px solid #0000FF;
border-right: 2px solid #0000FF;
border-bottom: 1px solid #0000FF;
border-left: 1px solid #0000FF;
}
</style>
<script type="text/javascript">
<!-- //
function verifica(){
var altezza = document.documentElement.scrollHeight
var latosx = Math.floor((screen.width-200)/2);
var latosup=Math.floor((altezza-150)/2);
if(document.getElementById("testo").value==""){
document.getElementById("alert").style.top=latosup+"px";
document.getElementById("alert").style.left=latosx+"px";
document.getElementById("alert").style.visibility='visible';
document.getElementById("alert").innerHTML="ATTENZIONE il campo testo e obbligatorio <a href=\"javascript:;\" onclick=\"document.getElementById('alert').style.visibility='hidden';\">chiudi</a>";
return false;
}
}
// -->
</script>
</head>
<body><div id="alert"></div>
</p>
</p>
</p>
</p>
</p>
</p>
</p>
</p>
</p>
</p>
</p>
</p>
</p>
</p>
</p>
</p>
</p>
</p>
</p>
</p>
</p>
</p>
</p>
</p>
</p>
</p>
</p>
</p>
</p>
<form action="" method="post" name="f1" onsubmit="return verifica()"><center><input name="testo" type="text" id="testo" class="prova" />
<input type="submit" name="Submit" value="Invia" />
</center></form>
</body>
</html>
buon lavoro