Box Model, Positioning CSS and Javascript by Aryan
Box Model, Positioning CSS and Javascript by Aryan
BOX MODEL
Block-Inline
Relative Position
Absolute Position
Fixed Vs Sticky Position
JAVASCRIPT
Client-side scripting refers to the use of scripts, typically
written in languages like JavaScript, HTML, and CSS, that run
on the user's web browser rather than on the web server. This
allows web pages to respond to user actions, update content
dynamically, validate forms, and enhance user interaction
without the need for a full page reload. Here are some key
aspects of client-side scripting:
### Advantages
1. **Reduced Server Load**: By handling some of the
processing on the client-side, the load on the server is
reduced.
2. **Improved User Experience**: Provides faster interactions
and more dynamic web pages.
3. **Offline Capabilities**: With technologies like Progressive
Web Apps (PWAs), parts of the application can work offline.
### Disadvantages
1. **Security Risks**: Client-side code is visible and can be
manipulated by users, making it less secure.
2. **Browser Compatibility**: Different browsers may
interpret scripts differently, leading to inconsistencies.
3. **Performance Issues**: Heavy client-side processing can
slow down the user's browser, especially on less powerful
devices.
### Examples
1. **AJAX (Asynchronous JavaScript and XML)**: Allows web
pages to be updated asynchronously by exchanging small
amounts of data with the server behind the scenes.
2. **DOM Manipulation**: Using JavaScript to dynamically
change the structure, style, and content of the document.
3. **Frameworks and Libraries**: Tools like React, Angular,
and Vue.js help manage the complexity of client-side scripting
and provide structured ways to build large-scale applications.
```html
<!DOCTYPE html>
<html>
<head>
<title>Form Validation</title>
<script type="text/javascript">
function validateForm() {
var x = document.forms["myForm"]["fname"].value;
if (x == "") {
alert("Name must be filled out");
return false;
}
}
</script>
</head>
<body>
</body>
</html>
```
In this example, the `validateForm` function checks if the
name field is empty. If it is, it displays an alert and prevents
the form from being submitted.
Difference:
Naming Conventions:
Data Types:
OPERATORS:
LOOSE EQUALITY : Different Datatype and same value
STRICT EQUALITY : Same Datatype And Same Value
Short circuiting :
CONCATENATION:
Using Backticks:
Length :
Uppercase:
Substring:
Ending Index Is Exclusive.
SPLIT() METHOD:
ARRAYSAND OBJECTS:
Actual Data Gets Stored on the heap , the variable is just a
reference to the data.
Adding Function To Object:
SHALLOW COPY :
ARRAYS:
Built in methods:
Slice method:
Map:
Filter Method:
To Filter string values just write ‘string’ in place of ‘number’.
Reduce Method:
FOR EACH:
SUM USING ARRAY FUNCTION:
Common In-Built Objects:
JS DOM:
BOM:
Element By Tagname:
Query Selector:
Query Selector Gets The First Element only that is found.
Query SelectorAll():
UPDATING HTML EXISTING ELEMENT:
Button had a p tag , with inner.Html We Can get the inner tags
of the element.
Same As UI display .
CreateElement:
Removing Element: