@astupidnameOct 29.2009 — #onsubmit is an event which is fired to submit a form, either via a submit type input button or input of type="image". onsubmit may also be triggered via script by invoking form.submit() where form is a reference to a form object. onclick is more generally an event which is fired any time the left mouse button is clicked. You could say I guess that submit buttons have by default an onclick event attached to them which fires the form's onsubmit event.
If your looking to load up new pages, you want to use the onClick event. Such as
[code=html]<!--This loads a new page in the current window.--> <a href="#" onclick="window.location='http://someplace.com';">New page</a>[/code]
Or if your looking for a popup window, you want somthing like. [code=html] <!--This creates a popup window with a size of 400px width and 600px height--> <a href="#" onclick="window.open ('http://someplace.com','MyWindow',width='400',height='600');">New page</a>[/code]
You could of course always link to a function like this. [CODE] <script type="text/javascript"> // This is in your header
// function for new page function newpage(url){ window.location=url; }
//function for popup window function newpopup(url,name){ window.open (url,name,width='400',height='600'); return false; </script> [/CODE]
And your html code to use those. [code=html] <!--This is for a new page--> <a href="#" onClick="newpage('http://somewhere.com');">New Page</a>
<!--This is for a popup window--> <a href="#" onClick="newpopup('http://somewhere.com','myWindow');">New Page</a> [/code]
Note: When I write my scripts I use double quotes " for HTML, and single quote ' for javascript so it doesn't get messy ?
There's a handful of arguments you can use with with popup windows. Heres a quick list. [CODE]status The status bar at the bottom of the window. toolbar The standard browser toolbar, with buttons such as Back and Forward. location The Location entry field where you enter the URL. menubar The menu bar of the window directories The standard browser directory buttons, such as What's New and What's Cool resizable Allow/Disallow the user to resize the window. scrollbars Enable the scrollbars if the document is bigger than the window height Specifies the height of the window in pixels. (example: height='350') width Specifies the width of the window in pixels.[/CODE]