Answer the question
In order to leave comments, you need to log in
Button or link?
I'm wondering if the use of the "a" tag or the button button for links matters? But what if I, for example, use script activation when clicking on a link, for example, to open a dialog box? Would a link tag be appropriate here, or would a button be better?
Answer the question
In order to leave comments, you need to log in
There is nothing particularly malicious in the button - except that its support in IE6 is ill (but who needs it) and according to the layout rules it must sit inside the form, and the a tag is a dinosaur, 97% of primitive browsers know it, even the one on my old one Samsung'e (but Opera from version 2.1 0_o).
In general, why button ? You can click on everything.
But links are convenient because they implement the JS or PHP scheme - when clicking on the link, if the browser can work with JS (and it is not disabled), the script is executed, otherwise the request is to a PHP file (the current page, as a rule).
<a href="?catType=2" onclick="sortContent(event, 2)">
Контент в виде таблицы
</a>
<a href="?catType=1" onclick="sortContent(event, 1)">
Контент в виде постов
</a>
//Тем временем в JS
...
function sortContent(e, n){
e.preventDefault();
//code
}
...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question