HTML and CSS Reference
In-Depth Information
'Follow the yellow brick road',
'Boldly go where no one has gone before',
'Go to jail. Go directly to jail. Do not pass go'
];
</script>
<a href="#" onclick="alert(messages[1]);"> Directions </a>
he conirm method is similar to alert . It presents a browser alert box with
OK and Cancel buttons. he method returns the value true if the user clicks
OK and false if the user clicks Cancel. his can be used to conditionally follow
a link. For example:
<a href="exit.html" onclick="return confirm(' Are you Sure ?');"> Exit </a>
here are two ways to open new browser windows: using a target attribute
in an anchor or area element, and using JavaScript's window.open method. he
following anchor element, for example, opens its linked page in a new window
that is a clone of the existing window:
<a href="http://outThere.com/" target=" _blank"> New Adventures </a>
he special target attribute value _blank creates an unnamed window.
he other special values are _parent , _top , and _self , to target other windows
depending on their relationship to the window that does the opening. Any
other target value is considered to be a name. If a window already exists with
that name, the new page replaces the document in the named window. Other-
wise, a new window with that name is created.
When more control of the opened window's features is needed, the
JavaScript window.open method is used:
window.open(URL, name, features);
he URL is the location of the document to be loaded in the window. he
name identiies an existing window to open the document in. If it is omitted,
or if no window by that name exists, the document opens in a new window
with that name. For example, this anchor element, when clicked:
<a href="#" onclick="window.open('help.html', '',
'width=450,height=600,scrollbars=1');"> help </a>
opens a new unnamed 450-by-600-pixel window, loaded with the document
help.html.
 
Search WWH ::




Custom Search