Постинг
10.05.2016 14:11 -
examples
document.write("Hello World!");
function Warn() {
alert ("This is a warning message!");
}
function getConfirmation(){
var retVal = confirm("Do you want to continue ?");
if( retVal == true ){
document.write ("User wants to continue!");
return true;
}
else{
document.write ("User does not want to continue!");
return false;
}
}
function getValue(){
var retVal = prompt("Enter your name : ", "your name here");
document.write("You have entered : " + retVal);
}
function js_style()
{
//font styles added by JS:
text.style.fontSize = "14pt";
text.style.fontFamily = "Comic Sans MS";
text.style.color = "blue";
}
function Msg1(){
document.getElementById("myText").innerHTML = "Thanks!";
}
function Msg2(){
document.getElementById("myText").innerHTML = "Try message 1 again...";
}
function showMsg(){
var userInput = document.getElementById("userInput").value;
document.getElementById("userMsg").innerHTML = userInput;
}
function changeColor(){
var newColor = document.getElementById("colorPicker").value;
document.getElementById("colorMsg").style.background = newColor;
}
if(document.images){
var image1 = new Image(); // Preload an image
image1.src = "images/web_development.jpg";
var image2 = new Image(); // Preload second image
image2.src = "images/web.jpg";
}
Alert Dialog Box.
Confirmation Dialog Box.
Prompt Dialog Box.
JavaScript DOM paragraph style
Basic innerHTML Example
innerHTML With User Input
Formatting with getElementById Choose a background color... None Yellow Salmon Light Blue Lime Green
Rollover with Mouse Events
Alert Dialog Box.
Click the following button to see the result:
Confirmation Dialog Box.
Click the following button to see the result:
Prompt Dialog Box.
Click the following button to see the result:
JavaScript DOM paragraph style
Web Technologies - JavaScript Exercises
StyleBasic innerHTML Example
innerHTML With User Input
Formatting with getElementById Choose a background color... None Yellow Salmon Light Blue Lime Green
Rollover with Mouse Events
Move your mouse over the image to see the result
Няма коментари