var searchStr = 'остер'
var source = document.querySelector('#source')
var result = document.querySelector('#result')
var regexp = new RegExp('('+searchStr+')', "gim");
result.innerHTML = source.innerHTML.replace(regexp, "<span>$1</span>");
Демо: https://jsfiddle.net/9c0n02Lp/This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user.
Замечание:© php.net/manual/ru/function.header.php
Спецификация HTTP/1.1 требует указывать абсолютный URI в качестве аргумента Location:
session_unset()
? Вы точно используете ее по назначению?В том и проблема, я не понимаю как сделать что б тут:if ($success){ echo "Success"; } else{ echo "Error"; } header('Refresh: 5; URL=http://mysite.net/index.html');
Вместо Success или Error, выдавало заготовки моих html страниц под это, а не просто слова в окне браузера. И что б эти странички висели и потом редиректило на Главную.
header('Refresh: ...')
нужно перенести в начало.echo "Success";
какой-то html код, типа такого <!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>HTML Document</title>
</head>
<body>
<p>
<b>
Этот текст будет полужирным,
<i>а этот - ещё и курсивным</i>
</b>
</p>
</body>
</html>
$start = 1 + $indent;
$end = $total - $indent;
$mid_start = $current - $indent;
$mid_end = $current + $indent;
public static function renderPaginator($total, $current, $indent = 3)
{
$start = 1 + $indent;
$end = $total - $indent;
$mid_start = $current - $indent;
$mid_end = $current + $indent;
?>
<nav style="margin: 0 auto;">
<ul class="pagination">
<?
$skip1 = ($start > $current || $current > $end);
if ($current == 1) { // previous
?><li class="disabled"><a href="#" aria-label="Previous"><span aria-hidden="true">«</span></a></li><?
} else {
?><li><a href="?page=<?=($current-1)?>" aria-label="Previous"><span aria-hidden="true">«</span></a></li><?
}
for ($p = 1; $p <= $total; $p++) { // each page
if ($p == $current) {
?>
<li class="active"><a href="#"><?=$p?> <span class="sr-only">(текущая)</a></li><?
} else {
if($p < $start
|| ($p > $mid_start && $mid_end > $p)
|| ($p > $end)
|| ($p == $start && $p == $mid_start)
|| ($p == $end && $p == $mid_end)
) {
?>
<li><a href="?page=<?=$p?>"><?=$p?></a></li><?
} elseif($p == $start || $p == $end) {
?>
<li class="disabled"><a href="#">...</a></li><?
}
}
}
if ($current == $total) { // next
?><li class="disabled"><a href="#" aria-label="Next"><span aria-hidden="true">»</span></a></li><?
} else {
?><li><a href="?page=<?=($current-1)?>" aria-label="Next"><span aria-hidden="true">»</span></a></li><?
}
?>
</ul>
</nav>
<?
}
<a href="#part2">перемотать к метке part2</a>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br>
<a name="part2">
<p>ура!</p>
while ( ... ) {
// какой-то код #1
}
// какой-то код #2, и он выполнится после того что #1
Вы не можете поменять таймзону в браузере. Предполагается, что вы будете использовать UTC даты, и только при выводе конвертировать их в местное время.Следующее выражение создаёт объект Date, используя всемирное время вместо местного:var utcDate = new Date(Date.UTC(96, 11, 1, 0, 0, 0));
© https://developer.mozilla.org/ru/docs/Web/JavaScri...
upd есть такая чудесная штука как moment.js, которая решает большинство проблем с датами.
Там и таймзоны есть: momentjs.com/timezone
$(".child").click(function(){
var num_active = $(this).index(".child");
});
function getIndex(el){
var index = 0;
while (el = el.previousElementSibling) {
index++;
}
return index;
}
const getIndex = el => [...el.parentNode.children].indexOf(el);
<script type="text/javascript" src="myscript.js?ver=3">
И если вы обновите эту цифру, то браузер запросит новую версию.$(elem).on('mousedown', function(){
$(this).on('mousemove', function(){
// code here
})
})
html семантика
Следующее выражение создаёт объект Date, используя всемирное время вместо местного:var utcDate = new Date(Date.UTC(96, 11, 1, 0, 0, 0));
!!
для приведения к boolean вообще чуть ли не стандарт. В jQuery встречается, например.var num = 12345;
var x = ("" + x)[3];
console.log(typeof x, x); // string 4
var y = +x * 10;
console.log(typeof x, typeof y, y); // string number 40
Краткость - сестра
Location
./wp-includes/formatting.php
на строке 4583
. Можете посмотреть что там происходит - конфиг подключается, или какой-то файл с BOM. /*xxx*/{"result":"1000"}/*xxx*/
- не является валидным JSON-ом.