Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //################## .html
- <!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>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Documento senza titolo</title>
- <script type="text/javascript" src="code.js">
- </script>
- </head>
- <body>
- <h1>
- <a href="javascript: prova();">run</a>
- </h1>
- </body>
- </html>
- //################### .JS
- // funzione
- function prova(){
- var coso =20;
- var nemo ="fufu ";
- ++coso;
- // usare + per unire piu stringhe
- // usare ++ per incrementare di 1 la variabile
- alert( nemo + "hauhauhauh " + coso);
- }
- ##################### esempio di IF
- // si ricollega al <a href="javascript: prova();">run</a>
- // e incrementa di 1
- var conta = 1;
- function prova(){
- var menti = true;
- if(menti){
- alert("vera... " + conta);
- menti = false;
- ++conta;
- }
- else
- {
- menti = true;
- ++conta;
- exit;
- }
- alert("falsa! " + conta);
- }
Advertisement
Add Comment
Please, Sign In to add comment