link.onclick = function(e) {
this.setAttribute( // this - это link, и именно ему вы устанавливаете атрибут src, который ничего не делает
'src',
this.getAttribute('src') // опять this, который указывааеет на link
.replace("сюда подставить данные из input",quantity.value));
}
iframe.src = quantity.value;
function hello(){
console.log('hello');
}
function goodbye(){
console.log('goodbye');
}
button1.onclick = hello;
button1.onclick = goodbye;
button2.addEventListener('click', hello);
button2.addEventListener('click', goodbye);
// при нажатии на первую кнопку сработает только goodbye, т.к. мы перезаписали свойство onclick
// при нажатии на вторую сработают обе функции, как и задумывалось
function showError(field, error) {
field.prepend(`<pre>Ошибка: ${error}</pre>`);
}
if (onlyDigits(last_name.val()) || last_name.val() == "") {
console.log('ошибка фамилии');
showError(last_name, allErrors.last_name);
return false;
} else {
return true;
}
<input name="last_name" required pattern="[А-ЯЁа-яё]+">
field.setCustomValidity("Минимум одна буква");
/list.php
,<a href="/list.php?count=2">показывать 2</a>
<a href="/list.php?count=4">показывать 4</a>
$cnt = filter_input(INPUT_GET, 'count', FILTER_SANITIZE_NUMBER_INT)
?: 1; // по умолчанию 1
echo "показываем $cnt элементов" ;
where id>100 and id<500
и обновлять порциями, размер порции сами подберите постепенно увеличивая.document.addEventListener('click', function myClickHandler(evt) { // слушаем все клики
if (evt.target.matches('.selector')){ // проверяем был ли это клик по .selector
// do your stuff
}
});
document.addEventListener('click', function myClickHandler(evt) { // слушаем все клики
const elem = evt.target.closest('.selector');
if (elem){ // если клик мимо, то тут null
// do your stuff
}
});
^.{3,7}(ABC)
function test(a, b) {
console.log(a,b);
}
// вызов
test(5,10);
function test(obj) {
console.log(obj.a, obj.b);
}
// вызов
test({'a':5, 'b' :10});
table.addEventListener('click', function(evt) {
const cell = evt.target.closest('span');
if (cell && cell.matches('tr td span')) {
alert(cell.textContent);
}
});
$('table').on('click', 'tr td span', function() {
alert(this.textContent);
});
большинство мониторов поддерживают DDC - можно управлять моником с компа.
https://ru.wikipedia.org/wiki/Display_Data_Channel
и есть софт
https://clickmonitorddc.bplaced.net/
(win, хоткеи + command line)
https://freemonitormanager.com/index.html
(win, не копался)
ddccontrol.sourceforge.net
(linux, все сложно, но есть гайды)
https://www.entechtaiwan.com/lib/softmccs.shtm
(не копался)