Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation
Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement.Téléchargez la présentation en cliquant sur ce lien.Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.
Javascript <script type="text/javascript"> var name = prompt('What is your name?', ''); document.write('<p>Welcome ' + name + '</p>'); </script> ACM 262 Course Notes
Javascript Creating an Array To create and store items in an array, you first declare the array’s name (just as youwould a variable) and then supply a list of comma separated values: each value representsone item in the list. To indicatean array, you put the list of items between opening and closing brackets—[ ]. var days = ['Mon', 'Tues', 'Wed', 'Thurs', 'Fri', 'Sat', 'Sun']; The brackets—[ ]—are very important. You can create an empty array without any elements like this: var playList = []; ACM 262 Course Notes
Javascript <script type="text/javascript"> var days = ['Mon', 'Tues', 'Wed', 'Thurs', 'Fri', 'Sat', 'Sun']; alert(days[0]); var i = 4; //alert(days[i]); </script> ACM 262 Course Notes
Adding Logic if (condition) { // write what happens } else if (condition2) { // write what happens } else { // write what happens } ACM 262 Course Notes
Adding Logic <script type="text/javascript"> var num= prompt(‘Enter a number', ‘60'); if (num >= 50) { alert(‘Thanks.'); } </script> ACM 262 Course Notes
Adding Logic varfridayCash = prompt('How much money can you spend?', ''); if (fridayCash >= 50) { alert('You should go out to a dinner and a movie.'); } else if (fridayCash >= 35) { alert('You should go out to a fine meal.'); } else if (fridayCash >= 12) { alert('You should go see a movie.'); } else { alert('Looks like you'll be watching TV.'); } ACM 262 Course Notes
Adding Logic Logical AND if (a < 10 && a > 1) { alert("The value " + a + " is between 1 and 10"); } Logical OR if (key == 'n' ||key == 'N') { //move to the next photo } Logical NOT if (! valid) { //print errors and don't submit form } ACM 262 Course Notes
Adding Logic if (dayOfWeek == 'Friday') { varfridayCash = prompt('How much money can you spend?', ''); if (fridayCash >= 50) { alert('You should go out to a dinner and a movie.'); } else if (fridayCash >= 35) { alert('You should go out to a fine meal.'); } else if (fridayCash >= 12) { alert('You should go see a movie.'); } else { alert('Looks like you'll be watching TV.'); } } ACM 262 Course Notes
Adding Logic do { // javascript to repeat } while (condition) ; do { varluckyNumber = prompt('What is your lucky number?',''); luckyNumber = parseInt(luckyNumber, 10); } while (isNaN(luckyNumber)); ACM 262 Course Notes
Adding Logic var num = 6; do{ document.write('Number ' + num + '<br>'); num = num + 1; } while (num <= 5) var num = 6; while (num <= 5) { document.write('Number ' + num + '<br>'); num = num + 1; } ACM 262 Course Notes