johnemmatty
Sun Sep 10 23:59:04 CDT 2006
Thanks to everyone replied to my query... especially to Evertjan, your
post helped me to solve my problem. Dave Anderson.. your post was
resourceful and served me to acquire new informations,and i really
really liked your signature.
Thanks,
John.
Dave Anderson wrote:
> johnemmatty@gmail.com wrote:
> > I am using an asp page in which i dynamically fill the ACTION property
> > of the form. The problem is that whenever i try to redirect to a html
> > page using the javascript:location, it is getting redirected to the
> > location in the ACTION attribute of the form element despite what is
> > assigned to the location attribute of the javascript.
> >
> > <FORM NAME="CRYSTFORM" METHOD=POST ACTION=<%=thisPage%>>
> >>
> >>
> >>
> >
> > </FORM>
> >
> >
> > <button onClick ="javascript:location='<%=goBackToURL%>'";id=button1
> > name=button1> OK </button>
>
> I would start by getting out of the habit of using the javascript:
> pseudo-protocol. The HTML specification requires the browser to hand the
> contents of ONCLICK attributes to a scripting engine:
>
> onclick = script [CT]
>
http://www.w3.org/TR/html4/interact/scripts.html#adef-onclick
>
> ...and...
>
> User agents must not evaluate script data as HTML markup but
> instead must pass it on as data to a script engine.
>
http://www.w3.org/TR/html4/types.html#type-script
>
> In my opinion, if you are using the javascript: pseudo-protocol, you are
> doing something wrong. More here:
http://jibbering.com/faq/#FAQ4_24
>
> But the real issue is that you did not realize that by default, the BUTTON
> element is the same as an INPUT TYPE="submit":
>
> 17.5 The BUTTON element
> type = submit|button|reset [CI]
> This attribute declares the type of the button.
> Possible values:
> * submit: Creates a submit button. This is the
> default value.
> * reset: Creates a reset button.
> * button: Creates a push button.
>
>
http://www.w3.org/TR/html4/interact/forms.html#edef-BUTTON
>
> Solutions include:
>
> - Use the TYPE="button" attribute
> - Cancel the action of the form by preventing
> the click action from propogating:
> onclick="location='<%=goBackToURL%>';return false"
> - Change to INPUT TYPE="button"
> - Use an anchor: <a href="<%=goBackToURL%>">
>
>
> --
> Dave Anderson
>
> Unsolicited commercial email will be read at a cost of $500 per message. Use
> of this email address implies consent to these terms.