Here is my code what is my problem. I need a window to open up that says ok or cancel.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang = "en" 

dir="ltr">

<head>

<meta http-equiv="content-type" content="text/html; charset=iso-8859-

1" />

<title>Exit Row Requirements</title>

</head>
<body>

<script type="text/javascript">
/* <![CDATA[ */

confirmed = window.confirm("Click OK to continue. Click Cancel to 

stop.");




if (window.confirm("Are you over 15 years old?") 
{
    document.write("<p>By the federal law, children under age 15
        must not sit in emergency exit rows,</p>");
}

      else if (window.confirm("Are you capable of lifting 50 or more
    pounds?"))
{
    document.write("<p>You must be able to lift 50 or more 
        pounds to sit in an exit row.</p>");
}


if (window.confirm("Are you willing to assist the crew in
    the event of an emergency?"))
{
    document.write("<p>To sit in an exit row, you must be 
        willing to assist the crew in the event of an
        emergency.</p>");
}
else 
{
    document.write("<p>You meet the criteria for sitting in an 
        exit row.</p>");


}


/* ]]> */
</script>
</body>

</html>

Firstly, you don't need window.confirm , confirm works just fine. Secondly, you're missing the ending ) on the first if-check.

thanks.

Am not sure if this what you need. But this wil help you to get familiar with confirm boxes. Feel free modify this script according to your needs...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang = "en"
dir="ltr">
<head>
<title>Exit Row Requirements</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-
1" />

<meta http-equiv="Script-Content-Type" content="text/javascript" />

<script type="text/javascript">
/* <![CDATA[ */

window.onload = function() 
{ 
  var result = document.getElementById('output');
  var confirmed = ( confirm("Click OK to continue. Click Cancel to stop.") == true ) ? result.innerHTML = '<strong>First Result:</strong><br />' + '<em>By the federal law, children under age 15 must not sit in emergency exit rows,</em><br /><br />' : result.innerHTML = 'Do other stuff from here!<br /><br />'.fontcolor('red');
confirmed = ( confirm("Are you capable of lifting 50 or more pounds?") == true ) ? result.innerHTML += '<strong>Second Result:</strong><br />' + '<em>You must be able to lift 50 or more pounds to sit in an exit row.</em><br /><br />' : result.innerHTML += 'Things you want to do goes here!<br /><br />'.fontcolor('blue');

confirmed = confirm("Are you willing to assist the crew in the event of an emergency?") 

if ( confirmed == true ) {  result.innerHTML += '<strong>Third Result:</strong><br />' + '<em>To sit in an exit row, you must be willing to assist the crew in the event of an emergency.</em><br /><br />';

result.innerHTML += '<span style="display:block;border: 2px solid #eee; font: 700 14px Georgia, \'Times New Roman\', Times, Serif; color:#009;background:#f2f2f2;padding:5px; margin: 2px;width: 120px; line-height:18px;letter-spacing:2px;">You meet the criteria for sitting in an exit row.</span>'; } 
else { result.innerHTML += 'Finaly it\'s over!<br /><br />'.fontcolor('green'); }
}
 /* ]]> */
</script>
</head>
<body>
<div id="output"></div>
</body>
</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.