var skater; var age = 20; var name = "threezh1"; var isBoy = ture/false; //This will not show for others.
document.write("Hello World.");
console.log("Just like history?");
<script src="mycode.js"></script>
GetUserEnter = prompt("Please enter whatever you want to say!"); document.write(GetUserEnter);
//Get a random.This will return a number in (0~1) var randomLoc = Math.random(); //If you want get a number in (0~5 haven't 5 like 4.999...) var randomLoc = Math.random() * 5; //Get a complete number: var randomLoc = Math.floor(Math.random() * 5);
function threezh1(varchar, number){ alert("What you wanna to say."); alert("This is the first parameter:" + varchar); alert("This is the second parameter:" + varchar); return0; }
threezh1("Hello World.", 33);
// If a variable is created in outside the function, it is a global variable.
// You can use a variable as a function name. var func = function(num){ ... } func(3);
// No name window.onload = function() { alert("Yeah, that page loaded/1");};
// Get a HtmlElement: var access = document.getElementById("id_name"); var code = access.innerHTML; alert(code); // The "code" is the text of label who id = id_name. // Ps: This codes should be put after the element.
// Change the text of a label: access.innerHTML = "Some other words what you wanna change!";
// If you wanna use a callback function. you can use the window.onload. <script> function init(){ var access = document.getElementById("id_name"); var code = access.innerHTML; alert(code); } window.onload = init; </script>
// Also, you can us setArribute to change the parameter in the table. access.setArribute("class", "redtext"); var ia_name = access.getArribute("id");