Tips n Tracks

  • Increase font size
  • Default font size
  • Decrease font size
  • default color
  • black color

Reference

Sample image

Microsoft .NET Framework Get Details.

Sample image

Microsoft .NET Framework Get Details.

Reference

Sample image Microsoft .NET Framework Get Details.
Sample image

Microsoft .NET Framework Get Details.


Learning JavaScript tutorial – JavaScript with Statement


Learning JavaScript tutorial – JavaScript with Statement

JavaScript offer lots of verity whiling dealing with the statements. Along with the flow control and loop control statements JavaScript supports object-related "with statements". With statement allows using a shorthand notation when referring objects and deals with the object scope chain.

with (object)
{
  statement(s);
}

Let us consider an example of the document object allows us to access the objects that compose a document. Using JavaScript with Statement we can access the scope of document object.

with (document)
{
  write("I Love JavaScript");
}

While working with JavaScript "with statement" blocks take care not to made any reference to other methods and properties. References to other methods and properties from JavaScript "with statement" block results in JavaScript Error.

Now consider the navigator object which provides information about the browser in use. Using JavaScript with Statement we can access all the Properties and methods of the navigator object.

<script type="text/javascript">
var navProperty="";
with (navigator)
{
 navProperty = navProperty + " PlatForm : " + platform;
 navProperty = navProperty + "\n Code Name : " + appCodeName;
 navProperty = navProperty + "\n Language : " + userLanguage;
 navProperty = navProperty + "\n Java Enable : " + javaEnabled();
}
alert(navProperty);
</script>

 

Chetan love blogging. He regularly blogs at http://www.tipsntracks.com. You can connect with Chetan on Twitter, Facebook and Google Plus...

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments

No comments yet.

Leave a comment

(required)

(required)

*
To prove that you're not a bot, enter this code
Anti-Spam Image