Resources
Javascript Code Snippets
Dreamweaver writes wonderful code for you, but it can't do everything. Sometimes, the only way to achieve a specific effect is write custom code or to copy and paste the code into Dreamweaver manually. The following snippets might come in useful.
Tool Tips
|
|
Ever notice that when you mouse over icons, a word balloon shows up with a "tip"? You can add "tips" to your links as well by adding a TITLE attribute. (This won't always work since the user can turn off this function in their browser preferences.)
|
Close Window
|
|
This Javascript code can be added to a link which will close the current window when clicked. This is especially useful when creating pop-up windows.
|
Open links in
|
|
Adding target="_blank" to links may not be supported in future releases of XHTML. If you still want a link to open up in a new window/or tab, here is a Javascript alternative.
|
Ipad redirect
|
|
This JavaScript code will detect for Ipad users and redirect the user to an alternative page. Source: scottrockers.com
|
Pop up
|
|
Dreamweaver has a built-in behavior to open browser windows at a specific size. Unfortunately, it requires that you use "#" as the link, which will scroll your main page back to the top (unless you start adding named anchors). An alternative is to use the following code instead (which also happens to be accessibility friendly). Source: daxassist.com
|
Pop up
|
|
Use this code if you're creating an entire web site in Flash and you need to open new browser windows at a specific size (download example source files). Source: kirupa.com Example: This is a Flash movie with a clickable button programmed to open a popup window scaled to 960x600 pixels:
|
Open Page in Frameset
|
|
If a page is intended to be opened only within
a frameset, this script refers the browser
immediately to the frameset page. Source: www.codelifter.com
|
Resizing
|
|
This Javascript code resizes the current
window and positions it where you want it. You can have this Javascript
activate upon page load by calling for it in the <body> tag.
A possible use for this code is when you want to launch a web site
in a pop-up window: you may wish to re-size the window underneath
so that it is hidden, allowing the top window to showcase your work
without any visual debris. Source: JavaScript
Kit Copy and paste the code from the following files:
|
Last updated: 5/19/10 Webmaster: Paul Young
