if I try:
window.open(url, "_self");
in firefox (2.0x), firefox just refreshes the current window, it
doesn't "goto" the url.
this works fine in IE 6 or 7.
anyone know what the deal is or a suitable workaround?
|
|
0
|
|
|
|
Reply
|
pbeisel (2)
|
3/6/2007 7:38:15 PM |
|
On Mar 6, 1:38 pm, "pbx" <pbei...@gmail.com> wrote:
> if I try:
>
> window.open(url, "_self");
don't use window.open here. if you want to change the url of the
current page and not open a new one i would use the location object.
location.href=url
|
|
0
|
|
|
|
Reply
|
Walton
|
3/6/2007 8:14:22 PM
|
|
On Mar 6, 12:14 pm, "Walton" <jrhol...@gmail.com> wrote:
> On Mar 6, 1:38 pm, "pbx" <pbei...@gmail.com> wrote:
>
> > if I try:
>
> > window.open(url, "_self");
>
> don't use window.open here. if you want to change the url of the
> current page and not open a new one i would use the location object.
>
> location.href=url
seems to work on IE but not Firefox.
|
|
0
|
|
|
|
Reply
|
pbx
|
3/6/2007 8:33:48 PM
|
|
On Mar 6, 2:33 pm, "pbx" <pbei...@gmail.com> wrote:
> On Mar 6, 12:14 pm, "Walton" <jrhol...@gmail.com> wrote:
>
> > On Mar 6, 1:38 pm, "pbx" <pbei...@gmail.com> wrote:
>
> > > if I try:
>
> > > window.open(url, "_self");
>
> > don't use window.open here. if you want to change the url of the
> > current page and not open a new one i would use the location object.
>
> > location.href=url
>
> seems to work on IE but not Firefox.
save this to a file and try it in firefox.
<html>
<head>
</head>
<body>
<input type="button" onclick="location.href='http://www.google.com'"
value="google"/>
</body>
</html>
is working for me.
|
|
0
|
|
|
|
Reply
|
Walton
|
3/6/2007 8:37:37 PM
|
|
On Mar 6, 12:37 pm, "Walton" <jrhol...@gmail.com> wrote:
> On Mar 6, 2:33 pm, "pbx" <pbei...@gmail.com> wrote:
>
> > On Mar 6, 12:14 pm, "Walton" <jrhol...@gmail.com> wrote:
>
> > > On Mar 6, 1:38 pm, "pbx" <pbei...@gmail.com> wrote:
>
> > > > if I try:
>
> > > > window.open(url, "_self");
>
> > > don't use window.open here. if you want to change the url of the
> > > current page and not open a new one i would use the location object.
>
> > > location.href=url
>
> > seems to work on IE but not Firefox.
>
> save this to a file and try it in firefox.
>
> <html>
> <head>
> </head>
> <body>
> <input type="button" onclick="location.href='http://www.google.com'"
> value="google"/>
> </body>
> </html>
>
> is working for me.
me too. but this isn't:
<html>
<head>
</head>
<body>
<form>
<input type="button" onclick="location.href='http://www.google.com'"
value="google"/>
<button onclick="location.href='http://www.google.com'">google 2</
button>
</form>
</body>
</html>
the second button that is. 2nd button doesn't work in firefox but
works fine in IE. do you know why?
(my button mark up is being generated by ASP.NET)
|
|
0
|
|
|
|
Reply
|
pbx
|
3/6/2007 10:35:38 PM
|
|
pbx said the following on 3/6/2007 5:35 PM:
<snip>
> <form>
> <input type="button" onclick="location.href='http://www.google.com'"
> value="google"/>
> <button onclick="location.href='http://www.google.com'">google 2</
> button>
> </form>
> </body>
> </html>
>
> the second button that is. 2nd button doesn't work in firefox but
> works fine in IE. do you know why?
A BUTTON element has a default type of SUBMIT, IE gets it wrong, and
with it as a child of the form it is submitting the form when you click it.
> (my button mark up is being generated by ASP.NET)
Either have ASP.NET specify it as type="button", move it outside the
form or add return false to the onclick handler.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
|
|
0
|
|
|
|
Reply
|
Randy
|
3/6/2007 11:15:16 PM
|
|
On Mar 6, 3:15 pm, Randy Webb <HikksNotAtH...@aol.com> wrote:
> pbx said the following on 3/6/2007 5:35 PM:
>
> <snip>
>
> > <form>
> > <input type="button" onclick="location.href='http://www.google.com'"
> > value="google"/>
> > <button onclick="location.href='http://www.google.com'">google 2</
> > button>
> > </form>
> > </body>
> > </html>
>
> > the second button that is. 2nd button doesn't work in firefox but
> > works fine in IE. do you know why?
>
> A BUTTON element has a default type of SUBMIT, IE gets it wrong, and
> with it as a child of the form it is submitting the form when you click it.
>
> > (my button mark up is being generated by ASP.NET)
>
> Either have ASP.NET specify it as type="button", move it outside the
> form or add return false to the onclick handler.
>
> --
> Randy
> Chance Favors The Prepared Mind
> comp.lang.javascript FAQ -http://jibbering.com/faq/index.html
> Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/
yes, it pretty much looks like a submit...
you can't easy move the mark up outside of the form, but for others
wondering you can use a HtmlInputButton control to generate a correct
(input style) button.
|
|
0
|
|
|
|
Reply
|
pbx
|
3/6/2007 11:18:38 PM
|
|
On 2007-03-06, pbx <pbeisel@gmail.com> wrote:
[snip]
><html>
><head>
></head>
><body>
><form>
><input type="button" onclick="location.href='http://www.google.com'"
> value="google"/>
><button onclick="location.href='http://www.google.com'">google 2</
> button>
></form>
></body>
></html>
>
> the second button that is. 2nd button doesn't work in firefox but
> works fine in IE. do you know why?
An INPUT element with type="botton" acts as a push button, which
has no default behavior. Clicking on the button triggers the
onclick event.
A BUTTON element without a TYPE attribute has a default type of
SUBMIT. Pressing the button submits the form. Because the FORM
element does not have an ACTION attribute, submitting the form
opens the document containing the FORM.
You want to include type="button" as a BUTTON attribute so the
button acts as a push button rather than a submit button.
|
|
0
|
|
|
|
Reply
|
A
|
3/6/2007 11:23:56 PM
|
|
|
7 Replies
130 Views
(page loaded in 0.083 seconds)
Similiar Articles:7/12/2012 1:13:08 PM
|