Jump to content

Search the Community

Showing results for tags 'Statement execution'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 1 result

  1. Hello & Thanks , I am trying to manually trace (alert !) when things get executed .The first thing i notice is that Hello World ! Then (Enter a number) number = prompt("Enter a number:", "5") document.write(Factorial(number)); Gets executed next .?? Does that means that 'everything js' outside of the Function gets executed first ???? sort of an initialization of the js code 1st?? Then: var r=confirm("CONFIRM: aNumber = "+aNumber+" " +"OK, keep going , or CANCEL "); Gets executed TWICE , no matter what I click on OK or CANCEL . Also , here: alert("aNumber is less than Zero !") return "undefined"; return "undefined"; gets executedButalert("aNumber is less than Zero !") does not .Pls , can someone show me what the proper code should be ?Also , how can I get each .innerHTML and document.write on a separate line , rather than write on a new page ? I would like to see all Trace stuff on the same page . Thanks...vm <!DOCTYPE html><html> <head> <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"> <title></title> <meta content="vmars316" name="author"> </head> <body onload="Factorial(4)"> <h3>Hello World !</h3> <p id="demo"> </p> <script> var TimesIn =0; function Factorial(aNumber){ { var x; var r=confirm("CONFIRM: aNumber = "+aNumber+" " +"OK, keep going , or CANCEL "); if (r==true) { x=(".innerHTML: x = "+"aNumber = " +aNumber+" " +"OK , keep on going!") ; document.getElementById("demo").innerHTML=x; } else { x="x = "+aNumber+" Cancel , it is !"; document.getElementById("demo").innerHTML=x; return; // Exit Function } document.getElementById("demo").innerHTML=x; }// If the number is not an integer, round it down. aNumber = Math.floor(aNumber); TimesIn = TimesIn + TimesIn + 1; document.write("TimesIn = " + TimesIn) ; alert()// The number must be equal to or bigger than zero if (aNumber < 0) { alert("aNumber is less than Zero !") return "undefined"; } if ((aNumber == 0) || (aNumber == 1)) { // If the number is 0 or 1, its Factorial is 1. alert("aNumber is 0 or 1, its Factorial is 1 !") return 1; } else { // Make a recursive call alert("aNumber * Factorial(aNumber - 1") return (aNumber * Factorial(aNumber - 1)); }} // End of Factorial number = prompt("Enter a number:", "5") document.write(Factorial(number)); </script> <p><br> </p> </body></html>
×
×
  • Create New...