This is a mirror of official site: http://jasper-net.blogspot.com/

Native Javascript Ninjutsu: Window object methods & properties

| Monday, October 25, 2010
Javascript used to be a dark and ancient art, looked down upon by many web developers as a dishonorable – even malicious – ‘copy and paste’ language. Macromedia’s Shockwave – which later became Macromedia Flash, which even later became Adobe Flash – pushed audio, video, and interactive motion graphics onto the web in a cross-browser compatible format that all but decimated the need and appeal for Javascript. What little Javascript community there was began to seriously dwindle and die out.

And then the frameworks came to rise: Dojo, Yahoo! UI Library, Google Web Toolkit, jQuery, Prototype, MooTools, and many more. With these powerful armies by its side, the Javascript community quickly grew and regained its honor, competing heavily with the fluid animation and complex, real-time interactivity that Flash had delivered for years.

Javascript now seems to be a strong, healthy, and widely accepted language, frequently used and relied upon by web developers across the land. Yet how many of today’s programmers can write pure native Javascript without the aid of a framework? How many can perform AJAX requests without a framework? And most importantly, how many can craft fully cross-browser compatible code without a framework? In order to not become dependent on the frameworks – and thus risk sliding backwards into the dark ages – we must maintain a wide variety of practices: these are the native Javascript disciplines.

Discipline 8: Sui-ren (water training)

NOTE: This article was written with the JS beginner in mind, so it will likely bore the rest of you!

Last week’s article covered the most useful properties and methods of the document object, so this week I’d like to zoom out a bit and explore the window object. Just like the document object, the window object has a variety of its own properties, objects, and methods, though we’ll only go over the most useful and interesting ones. Here’s a quick list of what we’ll discuss:

Properties/Objects:

window.document
window.frames
window.length
window.location
window.name
window.navigator
window.parent
window.self
window.top

Methods:

alert
confirm
prompt
setInterval
clearInterval
setTimeout
clearTimeout
window.open
window.close
window.focus
window.blur

Let’s take a look at some of the most useful (and cross-browser compatible) properties first:

Read more: sociomantic.com

Posted via email from .NET Info

0 comments: