Javascript Course


The location object is part of the window object (but also of the document object), and provides access to the current URL and its components. It can be accessed through the window.location property (or document.location).

window.location (or document.location ) returns the full URL address. But if you assign it a value (a string with a URL address) will load the page from that URL (makes redirect to that address).

- Example, it displays the full address of the page, and after five seconds it redirects to another address (in iframe if the script is into an <iframe>).
document.write('<p>Current address:<br>'+window.location+'<br><br>- After 5 seconds redirects to: //gamv.eu</p>');
window.setTimeout(()=>{window.location ='//gamv.eu';}, 5000);
This object has properties and methods that can be called with the syntax:
window.location.property_name
window.location.methodName()

Properties of the location object


Methods of the location object

Daily Test with Code Example

HTML
CSS
JavaScript
PHP-MySQL
Which tag defines the clickable areas inside the image map?
<map> <img> <area>
<img src="image.jpg" usemap="#map1">
<map name="map1">
  <area shape="rect" coords="9, 120, 56, 149" href="#">
  <area shape="rect" coords="100, 200, 156, 249" href="#">
</map>
Which CSS property defines what is done if the content in a box is too big for its defined space?
display overflow position
#id {
  overflow: auto;
}
Click on the event which is triggered when the mouse is positioned over an object.
onclick onmouseover onmouseout
document.getElementById("id").onmouseover = function(){
  document.write("Have Good Life");
}
Indicate the PHP variable that contains data added in URL address after the "?" character.
$_SESSION $_GET $_POST
if(isset($_GET["id"])) {
  echo $_GET["id"];
}
The location object

Last accessed pages

  1. Update and Delete in MySQL Table (1547)
  2. Website Mini-Traffic and Pages Access data (3061)
  3. Define and Use Classes in JavaScript (780)
  4. PHP Method Chaining (5417)
  5. Detecting events in ActionScript 3 (1397)

Popular pages this month

  1. Courses Web: PHP-MySQL JavaScript Node.js Ajax HTML CSS (496)
  2. PHP-MySQL free course, online tutorials PHP MySQL code (91)
  3. Read Excel file data in PHP - PhpExcelReader (55)
  4. The Mastery of Love (43)
  5. The Fifth Agreement (42)