HTML
HTML5
Cascade Stylesheet (CSS)
JavaScript
JQuery
Introduction to PHP
Control Structure (Decision and Loop)
Array In PHP
end
key
String Handling in PHP
chr
md5
String Matching with Regular Expression PHP
Math Functions in PHP
Generating Graphics and Images with PHP
Form and Method in PHP
Self & Sticky Forms / Pages
PHP XML Parser
Working with file and Directories
Function/Method in PHP
Classes and Objects in PHP
Const / Define
Encapsulation
Inheritance in PHP
Magic Methods in PHP
Abstract Class in PHP
Interface in PHP
Traits in PHP
Namespaces in PHP
Introspection in PHP
Exception Handling in PHP
Include / Require
Generating Graphics and Images with PHP
MySQL Database (PHPMyAdmin)
PHP Database Connectivity with MySQL
XML
simplexml PHP XML Parser
DOM PHP XML Parser
AJAX
AJAX with PHP
File Upload
Session and Cookies in PHP
JSON WebService with PHP
Website Designing
Google Tools
Search Engine Optimisation (SEO)
Domain and Hosting
Introduction To Javascript Events

PHP Developer

JavaScript

Basic functions

Content Author
Ashish D. Tiwari
Ashish D. Tiwari
First program
                            
                            

<!DOCTYPE html>

<html>

<head>

<script>

function change(){

document.getElementById("p1").innerHTML = "This paragraph is changed!";

}

</script>

</head>

<body>

<button onclick="change()">Change</button>

<p id="p1">

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod

tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,

quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo

consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse

cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non

proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

</p>

</body>

</html>

Description

change() is the user define function to change the content of paragraph.

onClick is the event which is call on Button click.

<script> tag is used to define a javascript function.

document.getElementById("paragraph") used to call a tag whose ID is "paragraph".

innerHTML is used for content between the tag.


Comment is Only Available for registered users! Create Account or Login Now!