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 attribute can be used to add CSS styles directly in the HTML tag?
type style class
<div style="width: 80%; border: 3px solid #888888;">Content</div>
Which CSS transform method distorts the HTML element in a given angle (including its content)?
translate() scale() skew()
#some_id {
  transform: skew(20deg, 25deg);
  -ms-transform: skew(20deg, 25deg);   /* IE 9 */
  -webkit-transform: skew(20deg, 25deg);   /* Safari and Chrome */
}
Click on the function which converts a Date object to a string.
indexOf() toString() getDate()
var rightnow = new Date();
alert( rightnow.toString() );
Which function applies a callback function to the elements of the given array?
array_merge() array_search() array_map()
$arr = arra("abc", "<p>xyz</p>", "<em>PHP</em>");
// apply the strip_tags() function to delete HTML tags from each array item
$arr = array_map("strip_tags", $arr);
}
Global Object

Last accessed pages

  1. Bubbles3 (47598)
  2. SHA512 Encrypt hash in JavaScript (7776)
  3. Mahjong2 (855)
  4. Mahjong Games (17769)
  5. Get Lower, Higher, and Closest Number (1574)

Popular pages this month

  1. Qwop (3030)
  2. Drag Racer V3 (1516)
  3. Bubbles3 (728)
  4. Flash Games - Free online Games (677)
  5. Courses Web: PHP-MySQL JavaScript Ajax HTML CSS Flash-AS3 (665)