BCA514 Unit 1 Internet Programming
BCA514 Unit 1 Internet Programming
By K K Bohra
BCA 514
2020
removeChild() Method
var list = document.getElementById("myList");
list.removeChild(list.childNodes[0]);
setAttribute() Method
document.getElementsByTagName("H1")[0].setAttribute("class",
“boyclass");
function closeWin() {
myWind.close();
}
/*
if (myWindow.closed) {
msg = "is closed";
} else {
msg = "is open";
}
*/
</script>
</head>
<body>
<form>
<input type="button" value="Open Window" onclick="openWin()">
</form>
w.resizeBy(50, 50);
w.focus();
myWindow.moveTo(300, 0);
myWindow.focus();
window.scrollTo(0, 100);
</script>
</head>
<body>
<form>
<input type="button" value="Open Window" onclick="openWin()">
</form>
document.getElementById("demo").innerHTML =
"The full URL of this page is:<br>" +
window.location.href;
document.getElementById("demo").innerHTML =
"Page path is: " + window.location.pathname;
window.location.replace('https://www.lmc.org')“
window.top.location = “home.htm";
</script>
History Object
<script>
function goBackForwd() {
window.history.back();
window.history.forward();
window.history.go(-2);// specific URL from History
}
</script>
History Object
<script>
function goBackForwd() {
window.history.back();
window.history.forward();
window.history.go(-2);// specific URL from History
}
</script>
document.getElementById("demo").innerHTML =
“Browser Name is " + navigator.appCodeName;
document.getElementById("demo").innerHTML =
"javaEnabled is " + navigator.javaEnabled();
</script>
if (confirm("Press a button!")) {
txt = "You pressed OK!";
} else {
txt = "You pressed Cancel!";
}
<script>
function myFunction() {
alert('Hello');
}
</script>
• Unit 3
Arrays, Array – Key pair value, Array functions, is SET, UNSET, gettype(),
settype(), control statements (if, switch), Loops, User Defined Functions
(with argument, return values), global variable, default value, GET - POST
method, URL encoding, HTML Encoding, Cookies, Sessions, Include
statement. File: read and write from the file. Ethical use of features of PHP.
• Unit 5
Introduction to OOPS, creating classes, creating objects, setting access to
properties and methods. Constructors, destructors, overloading and
overriding of methods. Accessing PHP and HTTP Data. Reading POST and
GET variables. Service Learning: - Teaching the Website design to school /
College students - Creating a website for a School/ NGO/
College/Department.
– 4GB space required for a typical live system with 1000-2000 events
– Network card
• Software Requirements
– Server
• LAMP Server
• MAMP Server
• XAMPP Server
• SAMP Server
• FAMP Server
WAMP Microsoft window o/s, Apache, MySQL, PHP
LAMP Linux o/s, Apache, MySQL, PHP
MAMP Mac o/s, Apache, MySQL, PHP
SAMP for Solaris
FAMP for FreeBSD
XAMPP
X-OS (cross operating system), Apache, MySQL, PHP
and Perl
Just create some .php files, place them in your web directory,
and the server will automatically parse them for you.
Escaping to PHP
• The PHP parsing engine needs a way to differentiate PHP code from other
elements in the page. The mechanism for doing so is known as 'escaping
to PHP‘.
<?php
phpinfo(); //it must be protected
?>
If you use this style, you can be positive that your tags will always be correctly
interpreted.
four ways…
2. Short-open (SGML-style) tags or Short or short-open tags
<?...?>
Short tags are, as one might expect, the shortest option you must do one of
two things to enable PHP to recognize the tags −
Choose the --enable-short-tags configuration option when you're building
PHP.
Set the short_open_tag setting in your php.ini file to on. This option must be
disabled to parse XML with PHP because the same syntax is used for XML
tags.
four ways…
2. Short-open (SGML-style) tags or Short or short-open tags
<?...?>
Short tags are, as one might expect, the shortest option you must do one of
two things to enable PHP to recognize the tags −
Choose the --enable-short-tags configuration option when you're building
PHP.
Set the short_open_tag setting in your php.ini file to on. This option must be
disabled to parse XML with PHP because the same syntax is used for XML
tags.
four ways…
3. ASP-style tags
ASP-style tags mimic (imitate) the tags used by Active Server Pages to
delineate code blocks. ASP-style tags look like this −
<%...%>
To use ASP-style tags, you will need to set the configuration option in your
php.ini file.
HTML script tags
HTML script tags look like this –
<script language="PHP">...</script>
Note
1. <?php … ?>
It is most probably used delimiters and also preferable, since, PHP code enclosed with in <?php .. ?>
could be recognized with other PHP servers independent of the tag related configuration directives.
2. <script language=”php”></script>
This will also work anywhere, like <?php … ?>.
3. <? … ?>
This is called as PHP short tags which will work based on the value set with short_open_tag directive of
PHP configuration file.
4. <?=..;?>
This is also short form of denoting PHP code, but used as an alternative representation of PHP print
statement.
Multi-lines comments
<?
/* This is a comment with multiline
Author : Mohammad Mohtashim
Purpose: Multiline Comments Demo
Subject: PHP
*/
PHP whitespace insensitive means that it almost never matters how many whitespace characters you
have in a row. One whitespace character is the same as many such characters.
For example, each of the following PHP statements that assigns the sum of 2 + 2 to the variable $four is
equivalent −
<?
$four = 2 + 2; // single spaces
$four <t>=<t>2<t>+ 2 ; // spaces and tabs
$four =
2+
2; // multiple lines
All results in 4
?>
PHP is case sensitive
• Yeah it is true that PHP is a case sensitive language.
<html>
<body>
<?php
$capital = 67;
print("Variable capital is $capital<br>");
print("Variable CaPiTaL is $CaPiTaL<br>");
?>
</body>
</html>
Variable capital is 67
Variable CaPiTaL is
Statements are expressions terminated by semicolons
The smallest building blocks of PHP are the indivisible tokens, such as
numbers (3.14159), strings (.two.), variables ($two), constants (TRUE), and
the special words that make up the syntax of PHP itself like if, else, while,
for and so forth
Braces make blocks
Although statements cannot be combined like expressions, you can always put a sequence of statements
anywhere a statement can go by enclosing them in a set of curly braces.
if (3 == 2 + 1)
print("Good – Bye !.<br>");
if (3 == 2 + 1)
{
print("Good - I haven't totally");
print("lost my mind.<br>");
}
Hello PHP!!!!!
Objective type