You are on page 1of 3

Web Development:

JavaScript:
• The querySelector() method returns the first element that matches a CSS
selector.
To return all matches (not only the first), use the querySelectorAll() instead.
Both querySelector() and querySelectorAll() throw a SYNTAX_ERR
exception if the selector(s) is invalid.
• The addEventListener(“click”, function) method attaches an event handler
to an element without overwriting existing event handlers.
• document.getElementById("demo").innerHTML = "Hello Dolly."; —> This
statement tells the browser to write "Hello Dolly." inside an HTML element
with id="demo"— To change the content of an HTML element
• Choose a background color :
<script>
function changebody() {
document.bgColor=document.getElementById("colorid").value;}
</script>
<form>
Choose a Background Color : declares when an input is changed.

<input type="color" id="colorid" onchange="changebody()">


</form>
• function mufunction() { document.body.style.fontFamily=('Arial,sans-
serif');}; (should set the font family first using style/css)
• In JavaScript, arrays always use numbered indexes.
• const points = [40]; != const points = new Array(40); Create an array
with 40 undefined elements:
• var li=document.createElement("li");
li.innerHTML=words[i]; add new li to an existing ul
document.getElementById("palindromes").appendChild(li);
• The Math.floor() function always rounds down and returns the largest
integer less than or equal to a given number.
• // Returns a random integer from 0 to 9:
Math.floor(Math.random() * 10);
Html:
• .htm and .html are equivalents.
• Each browser displays a webpage slightly different from the other browsers.
• HTML tags are NOT case sensitive
• DOCTYPE: NOT an HTML tag, Tells the browser what version of HTML
to expect (version 5 here)
• Empty elements : do not have an end tag. eg:<br>: line break.
• <h1>defines the most important (biggest) heading and <h2> defines the least
important (smallest) heading.
• I am trying all the tags in the table to know the difference: <em>I am </em>
<strong> trying</strong><sub>all the</sub><sup>tags</sup><ins>in the
table</ins><del>to know</del><mark>the difference</mark> (typeface.)
• a element is displayed in a fixed-width font(usually Courier), and it
preserves both spaces and line breaks.eg: <pre> it preserves both spaces
and breaks</pre> ----> it preserves both spaces and line breaks
• Hyperlink:<a href= “ ”> </a>
• <hr>: Creates a horizontal line in an HTML page Used to separate content.
• <img src= “source” alt= “description if thebrowser can't load images.”
• Unordered Lists:<ul>:bullets / Ordered Lists:<ol> : numbers/ Description
Lists:<dl>:right <dd> left <dt>
• <table> : <tr>:row ,<td>: cell in a row, <th>:header(bold,centered)
• The <iframe src= “html code/link” height=”” width=””> defines a
rectangular region within the document in which the browser can display a
separate document, including scrollbars, youtube videos, and borders.
• <video src= “ ” controls autoplay/pause/volume></video>
• <form>
<input type= “text/checkbox/radio/submit/reset”>
<select name= “ ”>
<option value= “ ”> </option>
</select>
</form>
• <header>Defines a header for the document or a section
• <article>Defines an article in the document
• <nav> Defines navigation links in the web page(add <ul> inside and <a>)
• <section> Defines a section in the document
• <aside>Defines content aside from the page(sidebar)
• <footer>Defines a footer for the document or a section
• <th colspan= “n”> </th>: cell span over n columns
• <textarea rows="4" cols="50" form="usrform" > </textarea>: feedback such
as the form it belongs to has id=usrform .(textarea outside <form>)

You might also like