I don't believe there is a notion of 'default button' in HTML. However if you create an input tag of type 'submit' it will be a button and you can place whatever you like in the 'value' attribute, i.e.:
<input type="submit" value="I am the default!">
Of course I believe this also only works inside a <form></form> element but I'm not sure about that.
I don't know about browser compatability but I think it works in IE and 'The other' browser.
If the button does not physically get pressed, its value is not submitted. You would have to test the form's submission by looking at a textbox, checkbox, etc. value.
First, test if a button was pressed, then if no buttons were pressed, but information was submitted (a textbox value for instance), you choose yourself what you want the default function to be.
For instance, if you had a combo box with employee id numbers in it, a delete button, and an edit button.
Your code would look something like this:
If request("editbutton" = "Edit" then
'allow user to edit that employee
ElseIf request("deletebutton" = "Delete" then
'delete that employee
ElseIf request("combobox" <> "" then
'you choose what you want to do as the default, whether it be editing or deleting
End If
I don't know about netscrap (which I am not coding for) (all are internal scripts) but in IE5.5 when you press enter button the html button that decides to get pressed does pass its name value pair!
But I think palbano had it mostly right - I found that if you had multiple buttons in your form you could make all except one of type="button" and have only one of type="submit" and the submit button will be what gets pressed when the enter button is pressed.
Any other experiences on this problem would be appreciated.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.