Using the with Statement in JavaScript : With : Language Basics : JavaScript DHTML examples (example source code) Organized by topic

JavaScript DHTML
C++
PHP
JavaScript DHTML Home »  Language Basics   » [  With  ]   
 



Using the with Statement in JavaScript

Please note that some example is only working under IE or Firefox.


/*
JavaScript Unleashed, Third Edition
by Richard Wagner and R. Allen Wyke 

ISBN: 067231763X
Publisher Sams CopyRight 2000

*/


<html>
<head>
  <title>JavaScript Unleashed</title>
</head>
<body>
  <script type="text/javascript">
  <!--
    with(document){
      write("Hello!");
      write("<br>The title of this document is, \"" + title + "\".");
      write("<br>The URL for this document is: " + URL);
      write("<br>Now you can avoid using the object's prefix each time!");
    }
  // -->
  </script>
</body>
</html>

           
       
Related examples in the same category
























Home| Contact Us
Copyright 2003 - 04 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.