Welcome, Guest |
You have to register before you can post on our site.
|
Online Users |
There are currently 1053 online users. » 0 Member(s) | 1051 Guest(s) Yandex, Bing
|
Latest Threads |
SELECT statement with MS ...
Forum: MS Access SQL Tutorials
Last Post: Qomplainerz
07-27-2023, 03:35 PM
» Replies: 0
» Views: 1,080
|
SELECT statement with the...
Forum: MS Access SQL Tutorials
Last Post: Qomplainerz
07-27-2023, 03:31 PM
» Replies: 0
» Views: 529
|
Creating hyperlinks in HT...
Forum: HTML5 Tutorials
Last Post: Qomplainerz
07-27-2023, 01:23 PM
» Replies: 0
» Views: 829
|
What's new in HTML5?
Forum: HTML5 Tutorials
Last Post: Qomplainerz
07-27-2023, 12:48 PM
» Replies: 0
» Views: 555
|
What is HTML5?
Forum: HTML5 Tutorials
Last Post: Qomplainerz
07-27-2023, 12:43 PM
» Replies: 0
» Views: 520
|
Neck isometric exercises
Forum: Exercises
Last Post: Qomplainerz
07-27-2023, 11:44 AM
» Replies: 0
» Views: 812
|
Shoulder shrug
Forum: Exercises
Last Post: Qomplainerz
07-27-2023, 11:43 AM
» Replies: 0
» Views: 476
|
Neck retraction
Forum: Exercises
Last Post: Qomplainerz
07-27-2023, 11:43 AM
» Replies: 0
» Views: 438
|
Neck flexion and extensio...
Forum: Exercises
Last Post: Qomplainerz
07-27-2023, 11:42 AM
» Replies: 0
» Views: 506
|
Neck rotation
Forum: Exercises
Last Post: Qomplainerz
07-27-2023, 11:42 AM
» Replies: 0
» Views: 478
|
|
|
Select elements by name in JavaScript |
Posted by: Qomplainerz - 04-04-2023, 07:36 AM - Forum: JavaScript Tutorials
- No Replies
|
|
The HTML part between the <body></body> tags looks like this:
Code: <!-- Select elements by name -->
<input type="radio" name="size" value="S"> S
<input type="radio" name="size" value="M"> M
<input type="radio" name="size" value="L"> L
<input type="radio" name="size" value="XL"> XL
<input type="radio" name="size" value="XXL"> XXL
The JavaScript part looks like this:
// Select elements by name
let elems = document.getElementsByName('size');
let sizes = [].map.call(elems, elem => elem.value);
document.write("<br>");
document.write(sizes);
document.write("<br>");
|
|
|
Select elements by tag name in JavaScript |
Posted by: Qomplainerz - 04-04-2023, 07:35 AM - Forum: JavaScript Tutorials
- No Replies
|
|
The HTML part between the <body></body> tags looks like this:
Code: <!-- Get elements by tag name -->
<div id="container">
<a href="https://nodejs.org/">Node.js</a>
<a href="https://openjsf.org/">OpenJS Foundation</a>
<a href="https://github.com/tc39">Ecma TC39</a>
</div>
The JavaScript part looks like this:
Code: let links = document.getElementsByTagName('a');
document.write("<br>");
document.write('Link count: ', links.length);
document.write("<br>");
// Show the href of links
for(let i = 0; i < links.length; i++)
{
document.write(links[i].href);
}
|
|
|
Select elements by class name in JavaScript |
Posted by: Qomplainerz - 04-04-2023, 07:33 AM - Forum: JavaScript Tutorials
- No Replies
|
|
The HTML part between the <body></body> tags looks like this:
Code: <!-- Select elements by class name -->
<div id="container">
<p class="note">The first note.</p>
<p class="note">The second note.</p>
<p class="note">The third note.</p>
</div>
The JavaScript part looks like this:
Code: // Select elements by class name
let elements = document.getElementsByClassName('note');
for(let i = 0; i < elements.length; i++)
{
document.write(elements[i].innerHTML);
}
|
|
|
Select elements by ID in JavaScript |
Posted by: Qomplainerz - 04-04-2023, 07:23 AM - Forum: JavaScript Tutorials
- No Replies
|
|
The HTML part between the <body></body> tags looks like this:
Code: <!-- Select elements by ID -->
<h1 id="message">JavaScript getElementById() Demo</h1>
The JavaScript part looks like this:
Code: // Select elements by ID
document.getElementById("message").innerHTML = "Demo";
|
|
|
Select elements by CSS selector in JavaScript |
Posted by: Qomplainerz - 04-04-2023, 07:18 AM - Forum: JavaScript Tutorials
- No Replies
|
|
The HTML part between the <body></body> tags looks like this:
Code: <!-- Selecting elements by CSS selector -->
<div id="container">
<p class="note">This is a note</p>
<p class="note">This is another note</p>
<p class="error">An error message</p>
</div>
The JavaScript part of the code looks like this:
Code: // Selecting elements by CSS selector
let container = document.querySelector("#container");
document.write(container);
|
|
|
|