The Global object has properties and methods at the highest level, without a parent object. This means that global properties and functions can be used with all the built-in JavaScript objects.


• The Global object has three properties:
Global object methods (or functions):
- In the following example is a JS script that uses the method eval() twice, transform and interpret the argument received as a JavaScript code.
<script type="text/javascript"><!--
function calcs(form) {
  form.re.value = eval(form.expr.value);
}
eval("alert('Have a good life!')");
--></script>
<form>
 <p>Enter a mathematical expression (addition, subtraction, multiplication, division), for example (7*8 or 3+8/2): </p>
 <input type="text" name="expr" size="35" />
 <input type="button" name="calc" value="Calculation" onclick="calcs(this.form)" /><br />
 The result is:
 <input type="text" name="re" size="18">
</form>
- This code displays an alert window and then the following result. A form that you can use for simple math operations:

Enter a mathematical expression (addition, subtraction, multiplication, division), for example (7*8 or 3+8/2):


The result is:

Daily Test with Code Example

HTML
CSS
JavaScript
PHP-MySQL
Which tag is used to add lists into <ul> and <ol> elements?
<dt> <dd> <li>
<ul>
 <li>http://coursesweb.net/html/</li>
 <li>http://coursesweb.net/css/</li>
</ul>
Which value of the "display" property creates a block box for the content and ads a bullet marker?
block list-item inline-block
.some_class {
  display: list-item;
}
Which instruction converts a JavaScript object into a JSON string.
JSON.parse() JSON.stringify eval()
var obj = {
 "courses": ["php", "javascript", "ajax"]
};
var jsonstr = JSON.stringify(obj);
alert(jsonstr);    // {"courses":["php","javascript","ajax"]}
Indicate the PHP class used to work with HTML and XML content in PHP.
stdClass PDO DOMDocument
$strhtml = '<body><div id="dv1">CoursesWeb.net</div></body>';
$dochtml = new DOMDocument();
$dochtml->loadHTML($strhtml);
$elm = $dochtml->getElementById("dv1");
echo $elm->nodeValue;    // CoursesWeb.net
Global Object

Last accessed pages

  1. Super Dragon Mahjongg (534)
  2. The Rise Of Atlantis (94)
  3. Butterfly Kyodai (1172)
  4. Jolly Jong 25 (190)
  5. Zuma Deluxe (1543)

Top accessed pages

  1. Courses Web: PHP-MySQL JavaScript Ajax HTML CSS Flash-AS3 (45775)
  2. Read Excel file data in PHP - PhpExcelReader (34434)
  3. PHP-MySQL free course, online tutorials PHP MySQL code (34319)
  4. Get Attribute (ID, Class, Name, Title, Src) with jQuery (30908)
  5. PHP PDO - exec (INSERT, UPDATE, DELETE) MySQL (28149)