22 Sep
Posted by admin as Javascript Codes, Technology Tips, Trainings
The following if – else conditions in javascript:
if statement – simple if statement, executed when condition is true
if…else statement – statements are executed when condition is true or false
if…else if….else statement - nested if – else statement which can b used for multiple blocks of code
switch statement - simplified nested if – else statement
Syntax
if statment:
if [...]
Here is a sample code on how to extract the mac address of a computer using the powerful javascript. The code will only work for internet explorer only.
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>Getting MAC Address From Javascript(IE Only)</title>
<script language=”javascript”>
function showMacAddress(){
var obj = new ActiveXObject(“WbemScripting.SWbemLocator”);
var s = obj.ConnectServer(“.”);
var properties = s.ExecQuery(“SELECT * FROM Win32_NetworkAdapterConfiguration”);
var e = new [...]
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| « May | ||||||
| 1 | 2 | 3 | 4 | |||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
| 19 | 20 | 21 | 22 | 23 | 24 | 25 |
| 26 | 27 | 28 | 29 | 30 | 31 | |