JavaScript Tutorial/Statement/With — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 08:25, 26 мая 2010
with
Syntax
with(object){
code;
}
with statement
The with statement works by placing the repetitive portion of the object"s path in parentheses.
The with Statement Reduces Repetitive Code.
<html>
<head>
<title>A Simple Page</title>
<script language="JavaScript">
<!--
inp1 = 1;
inp2 = 2;
inp3 = 3;
with (Math)
{
alert("The largest number entered was " + max(inp1, inp2, inp3));
alert("The smallest number entered was " + min(inp1, inp2, inp3));
}
// -->
</script>
</head>
<body>
</body>
</html>