[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using button events to jump to a new web page
At 5:03 AM 1/4/96, Lewis Sellers wrote:
>At 10:11 AM 1/2/96 -0500, you wrote:
>>To start with, I want to script a button to "onClick", go to
>>a particular URL. I can't seem to do this -- none of the netscape
>>examples are a help. The method window.open gets close to
>>what I want to do, but I want to go to the URL using the currently
>>open window, not in a new window. I don't know the name of the
>>default netscape window in any event.
I _think_ that what you want to do is something like
<form action="dummy.cgi">
<input type="button" name="foo" value="Click to FOO"
onClick="window.location='http://www.foo.com/bar.html'">
</form>
This puts up a button by itself, such that clicking on the button goes to a
new page corresponding to the specified URL; it's thus analogous to
clicking on a link, except that it's a button, and you don't need any
server-side CGI to make it work. (The action="dummy.cgi" is never used, as
the button is of type "button" rather than "submit".)
You could also have the URL be specified on the fly, either as a JavaScript
variable previously set:
var foovar = "http://www.foo.com/page" + i + ".html";
...
<form action="dummy.cgi">
<input type="button" name="foo" value="Click to FOO"
onClick="window.location=foovar">
</form>
or as the result of a JavaScript function:
function foofun() {
...
return "http://www.foo.com/page" + i + ".html"
}
...
<form action="dummy.cgi">
<input type="button" name="foo" value="Click to FOO"
onClick="window.location=foofun()">
</form>
Hope this helps.
Frank
--
Frank Hecker Pre-sales tech support, Netscape field sales group
hecker@netscape.com http://home.netscape.com/people/hecker/index.html