PDA

View Full Version : The "javascript:...etc" commands



Haisook
05-21-2005, 11:19 PM
I need to know all the javascript commands for closing a windows, reloading, returning, forwarding,..etc

Thanks :)

cr3ative
05-22-2005, 07:23 AM
Well with Frontpage, just type "window." and it'll give you the options.

Or you could use www.google.com.

http://img285.echo.cx/img285/9648/untitled5pq.gif

cr3ative

Haisook
05-22-2005, 10:10 AM
cr3ative,

I don't know if you got my point or not. I need to know the commands that can be inserted as links to close window, maximize windows, go back, go forward..etc

They start with "javascript: "

I tried the window thing but it didn't work.

cr3ative
05-22-2005, 11:38 AM
Back: <a href="javascript:history.go(-1)">Back</a>
Forward: <a href="javascript:history.go(1)">Forward</a>
Close: <a href="javascript:window.close()">Close Window</a>
Maximize: Not avaliable
Minimize: Not avaliable

This is all really easy to find using Google.
Sorry to sound a bit flamy, but really:
http://www.google.co.uk/search?hl=en&c2coff=1&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&q=javascript+backward+and+forward+buttons&btnG=Search&meta=

Gives you all the answers you need : )

cr3ative

mwinter
05-22-2005, 12:03 PM
I don't know if you got my point or not.He did. He's basically saying that you should look for a reference document that lists methods of the window (and history) object.


I need to know the commands that can be inserted as links to close window, maximize windows, go back, go forward..etc

They start with "javascript: "Not necessarily. What you're referring to is the javascript: pseudo-scheme. This can be used where a URL is expected, and causes the execution of script statements and expressions. However, most use of this pseudo-scheme is inappropriate: if blindly included in a public site, you'll be presenting - perhaps even relying on - something that will result in an error for users that haven't enabled client-side scripting.

The best way to include, say a link using the pseudo-scheme, is to write it in with the write method. For example,


if(('object' == typeof history) && history.back) {
document.write('<a href="javascript:history.back()">Go back<\/a>');
}If you want to invoke these methods amongst other code, then the pseudo-scheme isn't necessary.

Mike