Web Technology Pyq Part 2
Web Technology Pyq Part 2
DHTML stands for Dynamic Hypertext Markup Language. DHTML is not a language or technology. DHTML
is a combination of some technologies that help us create dynamic and interactive web pages.
In the 1990s, This combination of technologies called DHTML became famous among developers.
Because DHTML provides more features than just an HTML web page. As we know, HTML can only be
used to handle the front-end operations, but DHTML can handle the back-end operations.
HTML 4.0: HTML 4.0 was released in 1997, and HTML 4.0 is the fourth version of HTML. HTML 4.0
became the root component of DHTML.
CSS: CSS stands for Cascading Style Sheets that can be used to design HTML elements that lead to the
designing of web pages
JavaScript: It is a scripting language that is used to create interactive web pages. HTML elements can
manipulate and control with the help of JavaScript
DOM: DOM stands for Document Object Model, which acts like a programming interface for web pages.
DOM is an important part of both HTML and DHTML.
Syntax
<!DOCTYPE html>
<html>
<head>
<title>DHTML Syntax by Ninja</title>
</head>
<body>
<br />,
<script type=”text/javascript”>
</script>
</body>
</html>
DHTML was essential in the growth of the web, allowing web designers and developers to create more
interactive and responsive user interfaces. DHTML elevated static web pages from the past by utilizing
the strengths of HTML, CSS, JavaScript, and DOM to create animations, dynamic content updates, and
interactive components.
1. The easiest difference is static HTML once rendered cannot be changed on the other hand
dynamic HTML can be changed.
2. Static web pages cannot have database access but dynamic pages can be connected to database.
3. Using static HTML no interactions persist between user and server but dynamic HTML has
capability to interact with the user.
4. Static HTML does not require server side coding but dynamic HTML requires server side coding.
5. No animation, games can be developed using the static HTML but on the other hand dynamic
HTML can perform this task.
Static websites are ones that are fixed and display the same content for every user, usually written
exclusively in HTML.
A dynamic website, on the other hand, is one that can display different content and provide user
interaction, by making use of advanced programming and databases in addition to HTML.
Write a program in DHTML show various vocational courses running at your college
Sure, here is a program in DHTML that shows various vocational courses running at my college:
``html
<!DOCTYPE html>
<html>
<head>
<title>Vocational Courses</title>
<style>
Body {
Table {
Width: 100%;
Border-collapse: collapse;
Th, td {
Padding: 10px;
Text-align: center;
Tr:nth-child(even) {
Background-color: #f0f0f0;
</style>
</head>
<body>
<h1>Vocational Courses</h1>
<table>
<thead>
<tr>
<th>Course Name</th>
<th>Instructor</th>
<th>Time</th>
<th>Location</th>
</tr>
</thead>
<tbody>
<tr>
<td>Web Development</td>
<td>John Smith</td>
<td>Room 101</td>
</tr>
<tr>
<td>Programming</td>
<td>Jane Doe</td>
<td>Wednesdays and Fridays from 10am to 12pm</td>
<td>Room 202</td>
</tr>
<tr>
<td>Graphic Design</td>
<td>Michael Jones</td>
<td>Room 303</td>
</tr>
</tbody>
</table>
</body>
</html>
2. What is server Side scripting? And How it is different from client side scripting
Server-side scripting is a type of programming that is used to create dynamic web pages. It is executed
on the server, which is the computer that hosts the website. Client-side scripting, on the other hand, is
executed on the client’s computer, which is the computer that is being used to view the website.
The main difference between server-side and client-side scripting is that server-side scripts are executed
on the server, while client-side scripts are executed on the client’s computer. This means that server-side
scripts can access and modify data on the server, while client-side scripts can only access and modify
data on the client’s computer.
Server-side scripting is often used to create dynamic web pages that are customized for each user. For
example, a website might use server-side scripting to generate a personalized homepage for each user.
Client-side scripting is often used to create interactive web pages that allow users to interact with the
page in a way that is not possible with static web pages. For example, a website might use client-side
scripting to allow users to play games or to fill out forms.
Here are some examples of server-side scripting languages:
* PHP
* ASP.NET
* JSP
* Python
* Ruby
* JavaScript
* VBScript
* ActionScript
* EcmaScript
Server-side scripting is often used in conjunction with client-side scripting to create more complex and
interactive web pages. For example, a website might use server-side scripting to generate the page’s
content, while using client-side scripting to add interactivity to the page
A virtual directory is a directory that is not physically located on a computer. Instead, it is created and
stored on a server. When a user tries to access a virtual directory, the server will redirect the user to the
actual location of the file or folder. Virtual directories are often used to create a more user-friendly
interface for websites. For example, a website might have a virtual directory called “images” that
contains all of the images used on the website. When a user clicks on an image on the website, the
server will redirect the user to the actual location of the image on the server.
Virtual directories can also be used to create a more secure environment for websites. For example, a
website might have a virtual directory called “admin” that contains all of the administrative files for the
website. This virtual directory can be protected with a password, so that only authorized users can
access it.
Overall, virtual directories are a powerful tool that can be used to create a more user-friendly and secure
environment for websites
This will create a virtual directory called “Virtual Directory” in the “Path\To\Physical\Directory” folder.
You can then access the virtual directory as if it were a physical directory.
For example, if you have a physical directory called “My Documents” in the “C:\Users\YourUserName”
folder, you can create a virtual directory called “My Documents (Virtual)” in the “C:\Documents and
Settings\All Users\Start Menu\Programs\Accessories” folder by using the following command:
You can then access the virtual directory by clicking on the “My Documents (Virtual)” shortcut in the
“Start Menu”.
Please note that virtual directories are not real directories. They are simply shortcuts to physical
directories. This means that if you delete the physical directory, the virtual directory will also be deleted
* Server-side scripting: ASP.NET allows you to write code on the server side, which means that your code
will be executed on the server before it is sent to the client. This allows you to do things like access
databases, generate dynamic content, and validate user input.
* Web forms: ASP.NET web forms are a way to create user interfaces for your web applications. Web
forms are made up of controls, such as buttons, text boxes, and labels. You can use these controls to
create a variety of user interfaces.
* MVC: ASP.NET MVC is a model-view-controller framework that allows you to create well-designed and
maintainable web applications. MVC separates the application into three layers: the model, the view,
and the controller. The model represents the data that your application needs to work with. The view is
the user interface that your users will interact with. The controller is responsible for handling user input
and sending data to the model.
* Web API: ASP.NET Web API is a framework that allows you to create RESTful APIs. RESTful APIs are a
way to expose data and functionality from your web applications to other applications.
* SignalR: ASP.NET SignalR is a framework that allows you to create real-time web applications. Real-time
web applications are applications that can update their content without the user having to refresh the
page.
* Entity Framework: ASP.NET Entity Framework is a framework that allows you to work with data in a
database. The Entity Framework provides a number of features that make it easy to work with data,
including object-relational mapping (ORM), lazy loading, and change tracking.
* Razor Pages: ASP.NET Razor Pages is a new framework that allows you to create web applications using
a single file per page. Razor Pages is a simpler and more efficient way to create web applications than
web forms.
* Core: ASP.NET Core is a new version of ASP.NET that is designed to be cross-platform and modular.
ASP.NET Core is a major update to ASP.NET that includes a number of new features and improvements.
ASP.NET is a powerful and flexible framework that can be used to create a wide variety of web
applications. It is a popular choice for developers because it is easy to learn and use, and it provides a
wide range of features
Num1 = Request.Form(“num1”)
Num2 = Request.Form(“num2”)
Result = num1
Else
Result = num2
End If
%>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<form method=”post”>
</body>
</html>
5. Write difference between internal and external style sheet with help of examples.
An internal style sheet is a style sheet that is embedded in the HTML document. It is defined using the
<style> element, which is placed inside the <head> element of the document. The <style> element can
contain any number of CSS rules, which are used to style the elements of the document.
An external style sheet is a style sheet that is stored in a separate file. It is linked to the HTML document
using the <link> element, which is placed inside the <head> element of the document. The <link>
element can specify the location of the external style sheet file, as well as the media types that the style
sheet should apply to.
The main difference between internal and external style sheets is that internal style sheets are
embedded in the HTML document, while external style sheets are stored in a separate file. This means
that internal style sheets are only applied to the document in which they are defined, while external
style sheets can be applied to multiple documents.
Another difference between internal and external style sheets is that internal style sheets are more
convenient to use, but external style sheets are more flexible. Internal style sheets are more convenient
to use because they can be edited directly in the HTML document. However, external style sheets are
more flexible because they can be reused in multiple documents, and they can be modified without
having to edit the HTML document.
Html
<html>
<head>
<style>
Body {
Background-color: #ffffff;
H1 {
Font-size: 24px;
Font-weight: bold;
P{
Font-size: 16px;
</style>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
Here is an example of an external style sheet:
Css
Body {
Background-color: #ffffff;
H1 {
Font-size: 24px;
Font-weight: bold;
P{
Font-size: 16px;
The external style sheet can be linked to the HTML document using the following code:
``html
6. Write a program in Java script to input any number and check it prime or not.
Function isPrime(number) {
If (number <= 1) {
Return false;
}
If (number <= 3) {
Return true;
Return false;
Let I = 5;
Return false;
I += 6;
Return true;
If (isNaN(number)) {
} else {
If (result) {
} else {
}
}
“Active Data Object” (ADO) is a Microsoft technology that provides a programming interface to access
data from a variety of sources in a uniform manner. ADO is primarily used in the context of Microsoft
technologies, especially in conjunction with languages like Visual Basic, VBScript, and Jscript.
Uniform Data Access: ADO provides a consistent way to access data from different types of databases
and data sources. It can be used with various databases such as Microsoft Access, SQL Server, Oracle,
and more.
Data Source Independence: ADO allows you to interact with different data sources using the same code,
which means you can write code that accesses data without having to worry about the underlying
database.
Object-Oriented Model: ADO uses an object-oriented approach, which means it provides a set of objects
and methods for performing operations on data. This includes objects like Connection, Command,
Recordset, and more.
Disconnected Data Access: ADO supports both connected and disconnected modes. In disconnected
mode, data can be retrieved from a data source, manipulated, and then updated back to the data source
without maintaining a continuous connection
Data Binding: ADO supports data binding, which means you can bind data directly to user interface
elements like forms, grids, and controls. This allows for easy display and manipulation of data.
Security and Authentication: ADO includes features for managing authentication and security. This allows
you to control who can access the data and what operations they can perform.
Error Handling: ADO provides mechanisms for handling errors that may occur during data access
operations. This helps in creating robust applications that can gracefully handle unexpected situations.
Support for Various Languages: ADO can be used with a variety of programming languages including
VBScript, Jscript, Visual Basic, and others. This makes it versatile and compatible with a wide range of
development environments.
Integration with ActiveX Data Objects.NET (ADO.NET): ADO can work in conjunction with ADO.NET,
allowing developers to access data in both legacy COM-based environments and newer .NET
environments.
8. What is DOM
The DOM, or Document Object Model, is a programming interface for web documents. It represents the
structure of a document as a tree of objects. These objects can be manipulated with a scripting language
like JavaScript.
Structured Representation: The DOM represents an HTML or XML document as a tree structure. Each
element, attribute, and piece of text in the document is a node in the tree.
Platform and Language Agnostic: The DOM is not specific to any particular programming language or
platform. It is a standard that can be used with various languages, including JavaScript, Python, Java, and
more.
Dynamic: The DOM is dynamic, meaning it can be changed or manipulated after a page has loaded. This
allows for interactive web applications where elements can be added, removed, or modified in response
to user actions.
Hierarchical: Elements in the DOM are organized in a hierarchical manner, with a root node (usually
<html>) at the top, followed by nodes representing the various elements in the document (such as
<head>, <body>, <div>, etc.).
Object-Oriented: Each node in the DOM tree is an object, and these objects can be manipulated using
methods and properties. For example, you can change the content of an element, change its style, or
move it within the document.
Event-Driven: The DOM allows you to attach event handlers to elements. These handlers respond to
events like clicks, keypresses, and mouse movements. This enables interactivity in web pages.
Cross-Platform Compatibility: The DOM provides a standardized way to access and manipulate
documents across different web browsers. This helps ensure that web pages behave consistently across
different platforms and browsers.
API for Web Developers: Web developers use the DOM API to interact with web pages. This API provides
methods and properties that allow developers to traverse and manipulate the DOM tree.
Separation of Content and Presentation: The DOM represents the structure and content of a document,
while CSS (Cascading Style Sheets) is used to control the presentation and layout of elements.
Document-Centric: The DOM is primarily focused on documents, but it can also be used for XML
documents, which may not necessarily be displayed in a web browser.
Overall, the DOM is a fundamental concept for web development. It allows web pages to be dynamic,
interactive, and responsive to user actions. It plays a crucial role in creating modern web applications.
JavaScript, as a versatile programming language, provides a wide range of methods for various purposes.
Below are explanations of some commonly used methods in JavaScript:
String Methods:
indexOf(): Returns the position of the first occurrence of a specified substring within a string.
Array Methods:
Math Methods:
Math.floor() / Math.ceil() / Math.round(): Rounds a number down, up, or to the nearest integer,
respectively.
Math.max() / Math.min(): Returns the maximum or minimum value among a set of numbers.
Date Methods:
New Date(): Creates a new Date object representing the current date and time.
getMonth() / getDate() / getFullYear(): Returns the month, day, and year of a Date object, respectively.
Object Methods:
Object.assign(): Copies the values of all enumerable properties from one or more source objects to a
target object.
Function Methods:
Call() / apply(): Invokes a function with a specified this value and arguments provided individually or as
an array.
Bind(): Creates a new function with a specified this value and initial arguments.
Function factorial(n) {
If (n === 0 || n === 1) {
Return 1;
} else {
} else {
A Recordset is a data structure used in programming and database management to represent a set of
records, typically retrieved from a database. It’s a fundamental concept in data-driven applications,
especially in environments like ActiveX Data Objects (ADO) in Microsoft technologies or similar database
access libraries in other programming languages.
Tabular Data Structure: A Recordset is a tabular data structure that represents a set of records, where
each record consists of one or more fields or columns.
Dynamic and Navigable: Recordsets are dynamic, meaning you can move forward and backward through
the records, as well as add, edit, or delete records. This makes them suitable for interactive applications.
Database Query Results: In database programming, a Recordset is often the result of a database query. It
contains the data that matches the query criteria.
Fields and Records: A Recordset is made up of fields (columns) and records (rows). Each field represents
a specific attribute, and each record represents a single entry or row in the data.
Cursor Types: Recordsets can have different cursor types, such as forward-only, static, keyset-driven, or
dynamic. These define how the Recordset behaves with respect to navigation, updates, and data
visibility.
Methods and Properties: Recordsets have various methods and properties for navigating, editing, and
managing the data they represent. For example, you can use methods like MoveNext(), MoveFirst(),
AddNew(), and properties like RecordCount to work with the data.
A Connection object is a core component in database programming that provides a connection between
a program (like a web application or software) and a database. It allows the program to interact with the
database by sending queries, receiving results, and performing various operations.
Authentication and Authorization: It handles authentication and authorization, allowing the program to
access the database with the appropriate permissions.
Managing Transactions: The Connection object is used to manage transactions. Transactions ensure that
a series of operations are performed as a single unit. This is crucial for maintaining data integrity.
Executing SQL Queries: Once a connection is established, the Connection object allows you to execute
SQL queries against the database. This includes operations like retrieving data (SELECT), modifying data
(INSERT, UPDATE, DELETE), and more.
Creating Statements and Prepared Statements: It provides methods for creating SQL statements.
Prepared statements are a feature of Connection objects that allow for better performance and security
by pre-compiling SQL statements.
<%
Dim conn, rs
Response.Write “<tr><th>StudentID</th><th>Name</th><th>Age</th></tr>”
Response.Write “<tr>”
Response.Write “</tr>”
Rs.MoveNext
Loop
Response.Write “</table>”
Else
End If
‘ Clean up resources
Rs.Close
Set rs = Nothing
Conn.Close
14 Write aScript using ASP to input any name, age. Check eligibility to vote
<%
Name = Request.Form(“name”)
Age = Request.Form(“age”)
Age = CInt(age)
Else
Response.Write “Sorry “ & name & “, you are not yet eligible to vote.”
End If
Else
End If
%>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<form method=”post”>
</form>
</body>
</html>
Subroutine:
A subroutine, often referred to as a procedure or method, is a named block of code within a program
that performs a specific task. Subroutines are designed to be reusable and modular, allowing you to
organize your code into smaller, manageable pieces.
Does not Return a Value: A subroutine does not return a value. It performs a series of tasks and may
optionally modify variables or objects, but it does not produce a result that can be used in an expression.
May Take Parameters: Subroutines can accept input parameters (also known as arguments) that provide
information for the subroutine to work with.
Used for Code Organization: Subroutines are used to break down a program into smaller, more
manageable chunks. This improves code readability, reusability, and maintainability.
Function:
A function is similar to a subroutine in that it is a named block of code that performs a specific task.
However, a function also returns a value as a result of its execution.
Returns a Value: Unlike a subroutine, a function returns a value that can be used in an expression or
assigned to a variable.
May Take Parameters: Functions can accept input parameters to provide information for the function to
work with.
Produces a Result: The primary purpose of a function is to perform a calculation or operation and return
a result
A Recordset is a data structure used in programming and database management to represent a set of
records, typically retrieved from a database. It’s a fundamental concept in data-driven applications,
especially in environments like ActiveX Data Objects (ADO) in Microsoft technologies or similar database
access libraries in other programming languages.
Tabular Data Structure: A Recordset is a tabular data structure that represents a set of records, where
each record consists of one or more fields or columns.
Dynamic and Navigable: Recordsets are dynamic, meaning you can move forward and backward through
the records, as well as add, edit, or delete records. This makes them suitable for interactive applications.
Database Query Results: In database programming, a Recordset is often the result of a database query. It
contains the data that matches the query criteria.
Fields and Records: A Recordset is made up of fields (columns) and records (rows). Each field represents
a specific attribute, and each record represents a single entry or row in the data.
Cursor Types: Recordsets can have different cursor types, such as forward-only, static, keyset-driven, or
dynamic. These define how the Recordset behaves with respect to navigation, updates, and data
visibility.
Methods and Properties: Recordsets have various methods and properties for navigating, editing, and
managing the data they represent. For example, you can use methods like MoveNext(), MoveFirst(),
AddNew(), and properties like RecordCount to work with the data.
Recordsets play a crucial role in developing data-driven applications, enabling developers to interact with
and manipulate data retrieved from databases or other data sources. They are an essential part of
building dynamic and interactive software systems.
<%
‘ Get the ID of the record you want to delete (assuming it’s passed via a form or query string)
Dim recordID
recordID = Request.QueryString(“id”) ‘ Assuming you’re passing the ID in the query string
If IsNumeric(recordID) Then
Cmd.ActiveConnection = conn
Dim param
Param.Value = CInt(recordID)
Cmd.Parameters.Append param
Cmd.Execute
Else
End If
‘ Clean up resources
Conn.Close
Input in JavaScript:
The prompt function displays a dialog box that prompts the user for input. It returns the string entered
by the user.
Javascript
Copy code
In Node.js, you can use the readline module to read input from the command line.
Javascript
Copy code
Const rl = readline.createInterface({
Input: process.stdin,
Output: process.stdout
});
Rl.close();
});
Output in JavaScript:
1. Using console.log:
Javascript
Copy code
In web browsers, you can use alert to display a pop-up message to the user.
Javascript
Copy code
Asp
Copy code
<%
%>
<% and %>: These are ASP delimiters that indicate the beginning and end of ASP code blocks.
“Hello, World!”: This is the string that will be printed to the browser.
Save this code in an ASP file (e.g., hello.asp) and run it on a web server that supports ASP. When you
open this file in a browser, it will display “Hello, World
<!DOCTYPE html>
<html>
<head>
<title>Digital Lock</title>
<style>
Input[type=”button”] {
Width: 50px;
Height: 50px;
Font-size: 20px;
</style>
</head>
<body>
<h1>Digital Lock</h1>
<div>
</div>
<div>
</div>
<div>
</div>
<div>
</div>
<script>
Function enterDigit(digit) {
currentInput += digit;
Function clearInput() {
currentInput = “”;
Function checkCombination() {
If (currentInput.length === 4) {
clearInput();
} else {
clearInput();
} else {
</script>
</body>
</html>
In DHTML (Dynamic HTML), events refer to specific occurrences or interactions that happen within a web
page. These events can trigger JavaScript code to respond accordingly. Here are some common events in
DHTML:
onMouseOver: Triggered when the user’s mouse pointer moves over an element.
onMouseOut: Triggered when the user’s mouse pointer moves out of an element.
onUnload: Occurs when the user leaves the webpage or closes the browser window.
onChange: Occurs when the value of a form element (like a dropdown or input field) changes.
The innerText property is a property of DOM (Document Object Model) elements. It represents the text
content of an element and allows you to retrieve or set the text within an element.
Html
Copy code
In DHTML (Dynamic HTML), the term “layer” is often used to refer to a specific type of element that was
used in early versions of web development, particularly in Netscape Navigator browsers. Layers were a
way to position elements on a webpage and control their appearance and behavior.
Here’s a brief overview of the layer attribute and how it was used:
Layer Attribute:
Definition: The layer attribute was used to define a block-level element in HTML that could be
manipulated using JavaScript. It was mainly used in the context of Netscape Navigator.
Positioning: Layers allowed for precise positioning of elements on a webpage. You could specify the exact
coordinates (x and y) where a layer should appear.
Control and Animation: Layers could be moved, resized, hidden, and shown dynamically using JavaScript.
This made it possible to create animations and interactive elements.
Html
Copy code
</layer>
In the above example, a layer named “myLayer” is defined with specific positioning and dimensions.
The Execute method is not a standard method of the Connection object in web development. It’s
possible that you might be referring to a method specific to a particular programming framework or
library.
In many web development environments, including classic ASP, ASP.NET, and Node.js, the Execute
method is not a standard method associated with a Connection object. Instead, you typically use Execute
or similar methods with a command or query object, such as Command.Execute in ADO.NET.
If you can provide more context about the specific programming language or framework you’re using, I’d
be happy to assist you further.
24 Program in javascript code block using function to find sum of N natural numbers
Function sumOfNaturalNumbers(n) {
Let sum = 0;
Sum += I;
Return sum;
// Example usage:
An external stylesheet is a separate file containing CSS (Cascading Style Sheets) code that is linked to an
HTML document. This allows you to separate the presentation (style) of a webpage from its content,
making it easier to manage and maintain.
Open your favorite text editor (like Notepad, Visual Studio Code, Sublime Text, etc.) and create a new
file.
In this file, you’ll write your CSS code. For example, you can set styles for various elements like headings,
paragraphs, links, etc. For instance:
Css
Copy code
Body {
Background-color: #f0f0f0;
H1 {
Color: #333;
}
A{
Text-decoration: none;
Color: #007bff;
Mouse events in JavaScript refer to actions or interactions performed by a user using their mouse on a
web page. These events allow you to capture and respond to user actions such as clicking, hovering,
dragging, and more. Here are some common mouse events in JavaScript:
Click: Occurs when the user clicks a mouse button over an element.
Mousedown: Occurs when the user presses a mouse button over an element.
Mouseup: Occurs when the user releases a mouse button over an element.
myElement.addEventListener(“click”, function() {
alert(“Element clicked!”);
});
This example, when the element with the id “myElement” is clicked, an alert will pop up with the
message “Element clicked!”.
<!DOCTYPE html>
<html>
<head>
<script>
</script>
</head>
<body>
</body>
</html>Raj Ssjsn:
DHTML stands for Dynamic Hypertext Markup Language. DHTML is not a language or technology. DHTML
is a combination of some technologies that help us create dynamic and interactive web pages.
In the 1990s, This combination of technologies called DHTML became famous among developers.
Because DHTML provides more features than just an HTML web page. As we know, HTML can only be
used to handle the front-end operations, but DHTML can handle the back-end operations.
HTML 4.0: HTML 4.0 was released in 1997, and HTML 4.0 is the fourth version of HTML. HTML 4.0
became the root component of DHTML.
CSS: CSS stands for Cascading Style Sheets that can be used to design HTML elements that lead to the
designing of web pages
JavaScript: It is a scripting language that is used to create interactive web pages. HTML elements can
manipulate and control with the help of JavaScript
DOM: DOM stands for Document Object Model, which acts like a programming interface for web pages.
DOM is an important part of both HTML and DHTML.
Syntax
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h2>You are the best Ninja</h2>
<br />,
<script type=”text/javascript”>
</script>
</body>
</html>
DHTML was essential in the growth of the web, allowing web designers and developers to create more
interactive and responsive user interfaces. DHTML elevated static web pages from the past by utilizing
the strengths of HTML, CSS, JavaScript, and DOM to create animations, dynamic content updates, and
interactive components.
1. The easiest difference is static HTML once rendered cannot be changed on the other hand
dynamic HTML can be changed.
2. Static web pages cannot have database access but dynamic pages can be connected to database.
3. Using static HTML no interactions persist between user and server but dynamic HTML has
capability to interact with the user.
4. Static HTML does not require server side coding but dynamic HTML requires server side coding.
5. No animation, games can be developed using the static HTML but on the other hand dynamic
HTML can perform this task.
Static websites are ones that are fixed and display the same content for every user, usually written
exclusively in HTML.
A dynamic website, on the other hand, is one that can display different content and provide user
interaction, by making use of advanced programming and databases in addition to HTML.
Write a program in DHTML show various vocational courses running at your college
Sure, here is a program in DHTML that shows various vocational courses running at my college:
``html
<!DOCTYPE html>
<html>
<head>
<title>Vocational Courses</title>
<style>
Body {
Table {
Width: 100%;
Border-collapse: collapse;
Th, td {
Padding: 10px;
Text-align: center;
}
Tr:nth-child(even) {
Background-color: #f0f0f0;
</style>
</head>
<body>
<h1>Vocational Courses</h1>
<table>
<thead>
<tr>
<th>Course Name</th>
<th>Instructor</th>
<th>Time</th>
<th>Location</th>
</tr>
</thead>
<tbody>
<tr>
<td>Web Development</td>
<td>John Smith</td>
<td>Room 101</td>
</tr>
<tr>
<td>Programming</td>
<td>Jane Doe</td>
<td>Room 202</td>
</tr>
<tr>
<td>Graphic Design</td>
<td>Michael Jones</td>
<td>Room 303</td>
</tr>
</tbody>
</table>
</body>
</html>
2. What is server Side scripting? And How it is different from client side scripting
Server-side scripting is a type of programming that is used to create dynamic web pages. It is executed
on the server, which is the computer that hosts the website. Client-side scripting, on the other hand, is
executed on the client’s computer, which is the computer that is being used to view the website.
The main difference between server-side and client-side scripting is that server-side scripts are executed
on the server, while client-side scripts are executed on the client’s computer. This means that server-side
scripts can access and modify data on the server, while client-side scripts can only access and modify
data on the client’s computer.
Server-side scripting is often used to create dynamic web pages that are customized for each user. For
example, a website might use server-side scripting to generate a personalized homepage for each user.
Client-side scripting is often used to create interactive web pages that allow users to interact with the
page in a way that is not possible with static web pages. For example, a website might use client-side
scripting to allow users to play games or to fill out forms.
* ASP.NET
* JSP
* Python
* Ruby
* JavaScript
* VBScript
* ActionScript
* EcmaScript
Server-side scripting is often used in conjunction with client-side scripting to create more complex and
interactive web pages. For example, a website might use server-side scripting to generate the page’s
content, while using client-side scripting to add interactivity to the page
A virtual directory is a directory that is not physically located on a computer. Instead, it is created and
stored on a server. When a user tries to access a virtual directory, the server will redirect the user to the
actual location of the file or folder. Virtual directories are often used to create a more user-friendly
interface for websites. For example, a website might have a virtual directory called “images” that
contains all of the images used on the website. When a user clicks on an image on the website, the
server will redirect the user to the actual location of the image on the server.
Virtual directories can also be used to create a more secure environment for websites. For example, a
website might have a virtual directory called “admin” that contains all of the administrative files for the
website. This virtual directory can be protected with a password, so that only authorized users can
access it.
Overall, virtual directories are a powerful tool that can be used to create a more user-friendly and secure
environment for websites
This will create a virtual directory called “Virtual Directory” in the “Path\To\Physical\Directory” folder.
You can then access the virtual directory as if it were a physical directory.
For example, if you have a physical directory called “My Documents” in the “C:\Users\YourUserName”
folder, you can create a virtual directory called “My Documents (Virtual)” in the “C:\Documents and
Settings\All Users\Start Menu\Programs\Accessories” folder by using the following command:
You can then access the virtual directory by clicking on the “My Documents (Virtual)” shortcut in the
“Start Menu”.
Please note that virtual directories are not real directories. They are simply shortcuts to physical
directories. This means that if you delete the physical directory, the virtual directory will also be deleted
ASP.NET is a web application framework developed by Microsoft. It is a part of the .NET Framework and
is used to build web applications, web services, and mobile applications. ASP.NET is a powerful and
flexible framework that provides a wide range of features, including:
* Server-side scripting: ASP.NET allows you to write code on the server side, which means that your code
will be executed on the server before it is sent to the client. This allows you to do things like access
databases, generate dynamic content, and validate user input.
* Web forms: ASP.NET web forms are a way to create user interfaces for your web applications. Web
forms are made up of controls, such as buttons, text boxes, and labels. You can use these controls to
create a variety of user interfaces.
* MVC: ASP.NET MVC is a model-view-controller framework that allows you to create well-designed and
maintainable web applications. MVC separates the application into three layers: the model, the view,
and the controller. The model represents the data that your application needs to work with. The view is
the user interface that your users will interact with. The controller is responsible for handling user input
and sending data to the model.
* Web API: ASP.NET Web API is a framework that allows you to create RESTful APIs. RESTful APIs are a
way to expose data and functionality from your web applications to other applications.
* SignalR: ASP.NET SignalR is a framework that allows you to create real-time web applications. Real-time
web applications are applications that can update their content without the user having to refresh the
page.
* Entity Framework: ASP.NET Entity Framework is a framework that allows you to work with data in a
database. The Entity Framework provides a number of features that make it easy to work with data,
including object-relational mapping (ORM), lazy loading, and change tracking.
* Razor Pages: ASP.NET Razor Pages is a new framework that allows you to create web applications using
a single file per page. Razor Pages is a simpler and more efficient way to create web applications than
web forms.
* Core: ASP.NET Core is a new version of ASP.NET that is designed to be cross-platform and modular.
ASP.NET Core is a major update to ASP.NET that includes a number of new features and improvements.
ASP.NET is a powerful and flexible framework that can be used to create a wide variety of web
applications. It is a popular choice for developers because it is easy to learn and use, and it provides a
wide range of features
Num1 = Request.Form(“num1”)
Num2 = Request.Form(“num2”)
Result = num1
Else
Result = num2
End If
%>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<form method=”post”>
</form>
<% If Len(num1) > 0 And Len(num2) > 0 Then %>
</body>
</html>
5. Write difference between internal and external style sheet with help of examples.
An internal style sheet is a style sheet that is embedded in the HTML document. It is defined using the
<style> element, which is placed inside the <head> element of the document. The <style> element can
contain any number of CSS rules, which are used to style the elements of the document.
An external style sheet is a style sheet that is stored in a separate file. It is linked to the HTML document
using the <link> element, which is placed inside the <head> element of the document. The <link>
element can specify the location of the external style sheet file, as well as the media types that the style
sheet should apply to.
The main difference between internal and external style sheets is that internal style sheets are
embedded in the HTML document, while external style sheets are stored in a separate file. This means
that internal style sheets are only applied to the document in which they are defined, while external
style sheets can be applied to multiple documents.
Another difference between internal and external style sheets is that internal style sheets are more
convenient to use, but external style sheets are more flexible. Internal style sheets are more convenient
to use because they can be edited directly in the HTML document. However, external style sheets are
more flexible because they can be reused in multiple documents, and they can be modified without
having to edit the HTML document.
Here is an example of an internal style sheet:
Html
<html>
<head>
<style>
Body {
Background-color: #ffffff;
H1 {
Font-size: 24px;
Font-weight: bold;
P{
Font-size: 16px;
</style>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
Body {
Background-color: #ffffff;
H1 {
Font-size: 24px;
Font-weight: bold;
P{
Font-size: 16px;
The external style sheet can be linked to the HTML document using the following code:
``html
6. Write a program in Java script to input any number and check it prime or not.
Function isPrime(number) {
If (number <= 1) {
Return false;
If (number <= 3) {
Return true;
}
Return false;
Let I = 5;
Return false;
I += 6;
Return true;
If (isNaN(number)) {
} else {
If (result) {
} else {
Uniform Data Access: ADO provides a consistent way to access data from different types of databases
and data sources. It can be used with various databases such as Microsoft Access, SQL Server, Oracle,
and more.
Data Source Independence: ADO allows you to interact with different data sources using the same code,
which means you can write code that accesses data without having to worry about the underlying
database.
Object-Oriented Model: ADO uses an object-oriented approach, which means it provides a set of objects
and methods for performing operations on data. This includes objects like Connection, Command,
Recordset, and more.
Disconnected Data Access: ADO supports both connected and disconnected modes. In disconnected
mode, data can be retrieved from a data source, manipulated, and then updated back to the data source
without maintaining a continuous connection
Data Binding: ADO supports data binding, which means you can bind data directly to user interface
elements like forms, grids, and controls. This allows for easy display and manipulation of data.
Security and Authentication: ADO includes features for managing authentication and security. This allows
you to control who can access the data and what operations they can perform.
Error Handling: ADO provides mechanisms for handling errors that may occur during data access
operations. This helps in creating robust applications that can gracefully handle unexpected situations.
Support for Various Languages: ADO can be used with a variety of programming languages including
VBScript, Jscript, Visual Basic, and others. This makes it versatile and compatible with a wide range of
development environments.
Integration with ActiveX Data Objects.NET (ADO.NET): ADO can work in conjunction with ADO.NET,
allowing developers to access data in both legacy COM-based environments and newer .NET
environments.
8. What is DOM
The DOM, or Document Object Model, is a programming interface for web documents. It represents the
structure of a document as a tree of objects. These objects can be manipulated with a scripting language
like JavaScript.
Structured Representation: The DOM represents an HTML or XML document as a tree structure. Each
element, attribute, and piece of text in the document is a node in the tree.
Platform and Language Agnostic: The DOM is not specific to any particular programming language or
platform. It is a standard that can be used with various languages, including JavaScript, Python, Java, and
more.
Dynamic: The DOM is dynamic, meaning it can be changed or manipulated after a page has loaded. This
allows for interactive web applications where elements can be added, removed, or modified in response
to user actions.
Hierarchical: Elements in the DOM are organized in a hierarchical manner, with a root node (usually
<html>) at the top, followed by nodes representing the various elements in the document (such as
<head>, <body>, <div>, etc.).
Object-Oriented: Each node in the DOM tree is an object, and these objects can be manipulated using
methods and properties. For example, you can change the content of an element, change its style, or
move it within the document.
Event-Driven: The DOM allows you to attach event handlers to elements. These handlers respond to
events like clicks, keypresses, and mouse movements. This enables interactivity in web pages.
Cross-Platform Compatibility: The DOM provides a standardized way to access and manipulate
documents across different web browsers. This helps ensure that web pages behave consistently across
different platforms and browsers.
API for Web Developers: Web developers use the DOM API to interact with web pages. This API provides
methods and properties that allow developers to traverse and manipulate the DOM tree.
Separation of Content and Presentation: The DOM represents the structure and content of a document,
while CSS (Cascading Style Sheets) is used to control the presentation and layout of elements.
Document-Centric: The DOM is primarily focused on documents, but it can also be used for XML
documents, which may not necessarily be displayed in a web browser.
Overall, the DOM is a fundamental concept for web development. It allows web pages to be dynamic,
interactive, and responsive to user actions. It plays a crucial role in creating modern web applications.
JavaScript, as a versatile programming language, provides a wide range of methods for various purposes.
Below are explanations of some commonly used methods in JavaScript:
String Methods:
indexOf(): Returns the position of the first occurrence of a specified substring within a string.
Array Methods:
Math Methods:
Math.floor() / Math.ceil() / Math.round(): Rounds a number down, up, or to the nearest integer,
respectively.
Math.max() / Math.min(): Returns the maximum or minimum value among a set of numbers.
Date Methods:
New Date(): Creates a new Date object representing the current date and time.
getMonth() / getDate() / getFullYear(): Returns the month, day, and year of a Date object, respectively.
Object Methods:
Object.assign(): Copies the values of all enumerable properties from one or more source objects to a
target object.
Function Methods:
Call() / apply(): Invokes a function with a specified this value and arguments provided individually or as
an array.
Bind(): Creates a new function with a specified this value and initial arguments.
Function factorial(n) {
If (n === 0 || n === 1) {
Return 1;
} else {
} else {
A Recordset is a data structure used in programming and database management to represent a set of
records, typically retrieved from a database. It’s a fundamental concept in data-driven applications,
especially in environments like ActiveX Data Objects (ADO) in Microsoft technologies or similar database
access libraries in other programming languages.
Dynamic and Navigable: Recordsets are dynamic, meaning you can move forward and backward through
the records, as well as add, edit, or delete records. This makes them suitable for interactive applications.
Database Query Results: In database programming, a Recordset is often the result of a database query. It
contains the data that matches the query criteria.
Fields and Records: A Recordset is made up of fields (columns) and records (rows). Each field represents
a specific attribute, and each record represents a single entry or row in the data.
Cursor Types: Recordsets can have different cursor types, such as forward-only, static, keyset-driven, or
dynamic. These define how the Recordset behaves with respect to navigation, updates, and data
visibility.
Methods and Properties: Recordsets have various methods and properties for navigating, editing, and
managing the data they represent. For example, you can use methods like MoveNext(), MoveFirst(),
AddNew(), and properties like RecordCount to work with the data.
A Connection object is a core component in database programming that provides a connection between
a program (like a web application or software) and a database. It allows the program to interact with the
database by sending queries, receiving results, and performing various operations.
Establishing Database Connection: The Connection object is responsible for establishing a connection to
a specific database. This is the first step in working with databases in most programming languages.
Authentication and Authorization: It handles authentication and authorization, allowing the program to
access the database with the appropriate permissions.
Managing Transactions: The Connection object is used to manage transactions. Transactions ensure that
a series of operations are performed as a single unit. This is crucial for maintaining data integrity.
Executing SQL Queries: Once a connection is established, the Connection object allows you to execute
SQL queries against the database. This includes operations like retrieving data (SELECT), modifying data
(INSERT, UPDATE, DELETE), and more.
Creating Statements and Prepared Statements: It provides methods for creating SQL statements.
Prepared statements are a feature of Connection objects that allow for better performance and security
by pre-compiling SQL statements.
<%
Dim conn, rs
Set rs = Server.CreateObject(“ADODB.Recordset”)
Response.Write “<tr><th>StudentID</th><th>Name</th><th>Age</th></tr>”
Response.Write “<tr>”
Response.Write “</tr>”
Rs.MoveNext
Loop
Response.Write “</table>”
Else
End If
‘ Clean up resources
Rs.Close
Set rs = Nothing
Conn.Close
%>
14 Write aScript using ASP to input any name, age. Check eligibility to vote
<%
Name = Request.Form(“name”)
Age = Request.Form(“age”)
Age = CInt(age)
Else
Response.Write “Sorry “ & name & “, you are not yet eligible to vote.”
End If
Else
End If
%>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<form method=”post”>
</form>
</body>
</html>
Subroutine:
A subroutine, often referred to as a procedure or method, is a named block of code within a program
that performs a specific task. Subroutines are designed to be reusable and modular, allowing you to
organize your code into smaller, manageable pieces.
Does not Return a Value: A subroutine does not return a value. It performs a series of tasks and may
optionally modify variables or objects, but it does not produce a result that can be used in an expression.
May Take Parameters: Subroutines can accept input parameters (also known as arguments) that provide
information for the subroutine to work with.
Used for Code Organization: Subroutines are used to break down a program into smaller, more
manageable chunks. This improves code readability, reusability, and maintainability.
Function:
A function is similar to a subroutine in that it is a named block of code that performs a specific task.
However, a function also returns a value as a result of its execution.
Returns a Value: Unlike a subroutine, a function returns a value that can be used in an expression or
assigned to a variable.
May Take Parameters: Functions can accept input parameters to provide information for the function to
work with.
Produces a Result: The primary purpose of a function is to perform a calculation or operation and return
a result
A Recordset is a data structure used in programming and database management to represent a set of
records, typically retrieved from a database. It’s a fundamental concept in data-driven applications,
especially in environments like ActiveX Data Objects (ADO) in Microsoft technologies or similar database
access libraries in other programming languages.
Tabular Data Structure: A Recordset is a tabular data structure that represents a set of records, where
each record consists of one or more fields or columns.
Dynamic and Navigable: Recordsets are dynamic, meaning you can move forward and backward through
the records, as well as add, edit, or delete records. This makes them suitable for interactive applications.
Database Query Results: In database programming, a Recordset is often the result of a database query. It
contains the data that matches the query criteria.
Fields and Records: A Recordset is made up of fields (columns) and records (rows). Each field represents
a specific attribute, and each record represents a single entry or row in the data.
Cursor Types: Recordsets can have different cursor types, such as forward-only, static, keyset-driven, or
dynamic. These define how the Recordset behaves with respect to navigation, updates, and data
visibility.
Methods and Properties: Recordsets have various methods and properties for navigating, editing, and
managing the data they represent. For example, you can use methods like MoveNext(), MoveFirst(),
AddNew(), and properties like RecordCount to work with the data.
Recordsets play a crucial role in developing data-driven applications, enabling developers to interact with
and manipulate data retrieved from databases or other data sources. They are an essential part of
building dynamic and interactive software systems.
<%
‘ Get the ID of the record you want to delete (assuming it’s passed via a form or query string)
Dim recordID
Cmd.ActiveConnection = conn
Dim param
Param.Value = CInt(recordID)
Cmd.Parameters.Append param
Cmd.Execute
Else
End If
‘ Clean up resources
Conn.Close
%>
The prompt function displays a dialog box that prompts the user for input. It returns the string entered
by the user.
Javascript
Copy code
In Node.js, you can use the readline module to read input from the command line.
Javascript
Copy code
Const rl = readline.createInterface({
Input: process.stdin,
Output: process.stdout
});
Rl.close();
});
Output in JavaScript:
1. Using console.log:
Copy code
In web browsers, you can use alert to display a pop-up message to the user.
Javascript
Copy code
Asp
Copy code
<%
%>
<% and %>: These are ASP delimiters that indicate the beginning and end of ASP code blocks.
“Hello, World!”: This is the string that will be printed to the browser.
Save this code in an ASP file (e.g., hello.asp) and run it on a web server that supports ASP. When you
open this file in a browser, it will display “Hello, World
<html>
<head>
<title>Digital Lock</title>
<style>
Input[type=”button”] {
Width: 50px;
Height: 50px;
Font-size: 20px;
</style>
</head>
<body>
<h1>Digital Lock</h1>
<div>
</div>
<div>
</div>
<div>
<input type=”button” value=”7” onclick=”enterDigit(7)”>
</div>
<div>
</div>
<script>
Function enterDigit(digit) {
currentInput += digit;
Function clearInput() {
currentInput = “”;
Function checkCombination() {
If (currentInput.length === 4) {
clearInput();
} else {
} else {
</script>
</body>
</html>
In DHTML (Dynamic HTML), events refer to specific occurrences or interactions that happen within a web
page. These events can trigger JavaScript code to respond accordingly. Here are some common events in
DHTML:
onMouseOver: Triggered when the user’s mouse pointer moves over an element.
onMouseOut: Triggered when the user’s mouse pointer moves out of an element.
onUnload: Occurs when the user leaves the webpage or closes the browser window.
onChange: Occurs when the value of a form element (like a dropdown or input field) changes.
The innerText property is a property of DOM (Document Object Model) elements. It represents the text
content of an element and allows you to retrieve or set the text within an element.
Copy code
In DHTML (Dynamic HTML), the term “layer” is often used to refer to a specific type of element that was
used in early versions of web development, particularly in Netscape Navigator browsers. Layers were a
way to position elements on a webpage and control their appearance and behavior.
Here’s a brief overview of the layer attribute and how it was used:
Layer Attribute:
Definition: The layer attribute was used to define a block-level element in HTML that could be
manipulated using JavaScript. It was mainly used in the context of Netscape Navigator.
Positioning: Layers allowed for precise positioning of elements on a webpage. You could specify the exact
coordinates (x and y) where a layer should appear.
Control and Animation: Layers could be moved, resized, hidden, and shown dynamically using JavaScript.
This made it possible to create animations and interactive elements.
Html
Copy code
This is a layer.
</layer>
In the above example, a layer named “myLayer” is defined with specific positioning and dimensions.
23. Execute method of connection Object
The Execute method is not a standard method of the Connection object in web development. It’s
possible that you might be referring to a method specific to a particular programming framework or
library.
In many web development environments, including classic ASP, ASP.NET, and Node.js, the Execute
method is not a standard method associated with a Connection object. Instead, you typically use Execute
or similar methods with a command or query object, such as Command.Execute in ADO.NET.
If you can provide more context about the specific programming language or framework you’re using, I’d
be happy to assist you further.
24 Program in javascript code block using function to find sum of N natural numbers
Function sumOfNaturalNumbers(n) {
Let sum = 0;
Sum += I;
Return sum;
// Example usage:
Open your favorite text editor (like Notepad, Visual Studio Code, Sublime Text, etc.) and create a new
file.
In this file, you’ll write your CSS code. For example, you can set styles for various elements like headings,
paragraphs, links, etc. For instance:
Css
Copy code
Body {
Background-color: #f0f0f0;
H1 {
Color: #333;
A{
Text-decoration: none;
Color: #007bff;
Mouse events in JavaScript refer to actions or interactions performed by a user using their mouse on a
web page. These events allow you to capture and respond to user actions such as clicking, hovering,
dragging, and more. Here are some common mouse events in JavaScript:
Click: Occurs when the user clicks a mouse button over an element.
Mousedown: Occurs when the user presses a mouse button over an element.
Mouseup: Occurs when the user releases a mouse button over an element.
myElement.addEventListener(“click”, function() {
alert(“Element clicked!”);
});
This example, when the element with the id “myElement” is clicked, an alert will pop up with the
message “Element clicked!”.
<!DOCTYPE html>
<html>
<head>
<script>
</script>
</head>
<body>
</body>
</html>ASP.NETASP.NET