我有一个 javascript 确认框,如果用户单击确定,那么我想运行一个 php 脚本。不知道如何做到这一点。下面是确认框的javascript代码:
<script type="text/javascript">
function val_name()
{
var namePattern = /^[A-Za-z]{3,25}$/;
if( !namePattern.test(document.upload.fn.value))
alert("Enter valid first name");
if( !namePattern.test(document.upload.ln.value))
alert("Enter valid last name");
var x=document.forms["upload"]["email"].value;
var atpos=x.indexOf("@");
var dotpos=x.lastIndexOf(".");
if (atpos < 1 || dotpos < atpos + 2 || dotpos + 2 >= x.length)
{
alert("Not a valid e-mail address");
return false;
}
else if
(confirm("Are you sure you want to add this driver?")== true)
{
onClick = 'add_driver.php';
}
}
</script>