Javascript 中的 with
如下:
<!DOCTYPE html>
<html>
<head>
<title>js2.html</title>
</head>
<body>
<script type="text/javascript">
with (document)
{
write("<ol>");
write("<li>hello</li>");
write("<li>world</li>");
write("<li>hello world</li>");
write("</ol>");
}
</script>
<br>
</body>
</html>
结果:
- hello
- world
- hello world
浙公网安备 33010602011771号