User Tools

Site Tools

tools:javascript

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
tools:javascript [2025/09/30 22:44] – external edit 127.0.0.1tools:javascript [2025/10/12 10:51] (current) Humphrey Boa-Gart
Line 1: Line 1:
-{{wst>iw-cleanup}} +#redirect tools:languages:javascript
- +
-====== JavaScript ====== +
- +
-JavaScript is a scripting language developed by Brendan Eich in 1995. +
- +
-===== Adding text ===== +
- +
-One of the most basic commands in JavaScript is the document.write ("") command. Whatever you write between the first quotation mark and the second quotation mark is what will be written on the page. +
- +
-  <script LANGUAGE="JavaScript" type="text/javascript"> +
-  document.write ("I like dongs"); +
-  </script> +
- +
-===== Adding comments ===== +
- +
-Another basic JavaScript command is the // command. Whatever is written after the two slashes will serve as a note or reminder, and will not show up in your document. +
- +
-  <script LANGUAGE="JavaScript" type="text/javascript"> +
-  // Do you like dongs?; +
-  document.write ("I like dongs"); +
-  </script> +
- +
-===== Defining variables ===== +
- +
-Defining variables can be done by adding var followed by the variable name, the =, and then the value. If the value is something other than a number, you must surround it with quotation marks (examplevar name="dongs"). +
- +
-  <script LANGUAGE="JavaScript" type="text/javascript"> +
-  // Do you like dongs?; +
-  var x=2; +
-  document.write ("I like dongs with x balls"); +
-  </script> +
- +
-==== Using specific phrases as variables ==== +
- +
-  <script LANGUAGE="JavaScript" type="text/javascript"> +
-  msg1="so i herd"; +
-  msg2="u liek mudkips"; +
-  msg3="I FUCKING LUUUURVE MUDKIPS"; +
-  msg4=msg1+" "+msg2; +
-  document.write (msg4); +
-  document.write (msg3); +
-  </script> +
- +
-===== Inserting special characters ===== +
- +
-In order to insert special characters, such as quotation marks, symbols, ampersands, apostrophes, etc, they must be preceded by a backslash. +
- +
-  <script LANGUAGE="JavaScript" type="text/javascript"> +
-  document.write ("I liked Rick Astley's song \"Never Gonna Give You Up\" because it's awesome."+
-  </script> +
- +
-===== If...else ===== +
- +
-The if...else command can be useful in the case that under certain conditions, one thing will be true, but otherwise, another will be true. +
- +
-  <script LANGUAGE="JavaScript" type="text/javascript"> +
-  // Do you like dongs?; +
-  var d=new Date(); +
-  var time=d.getHours(); +
-  if (time<6) +
-  { +
-  document.write ("I like dongs"); +
-  } +
-  else +
-  { +
-  document.write ("I liek Mudkips"+
-  } +
-  </script> +
- +
-===== Popups ===== +
- +
-With a popup box, the alert ("") will be the text inside of the box, and the value="" underneath will serve as the button you must press in order to make the popup box appear. +
- +
-  <head> +
-  <script LANGUAGE="JavaScript" type="text/javascript"> +
-  function show_alert() +
-  { +
-  alert("Yes, I luuuuurve dongs"); +
-  } +
-  </script> +
-  </head> +
-  <body> +
-  <input type="button" onclick="show_alert()" value="Do you like dongs?" /> +
-  </body> +
-   +
-===== Links ===== +
- +
-[[http://www.w3schools.com/js/default.asp|W3 Schools interactive tutorial]] +
- +
-[[http://en.wikipedia.org/wiki/Javascript|Wikipedia article on JavaScript]] +
- +
- +
-{{tag>Tools Programming}}+
tools/javascript.txt · Last modified: by Humphrey Boa-Gart

Find this page online at: https://bestpoint.institute/tools/javascript