ini_set('display_errors', 1);
error_reporting(E_ALL);
<!-- DRAG & DROP -->
<script type="text/javascript">
$(function() {
$('#tasksCart_01, #tasksCart_03').sortable({
connectWith: '#tasksCart_01, #tasksCart_03',
change: function( event, ui ) {
$('#елемент-на-который-нужно-нажать').trigger('click');
}
});
});
</script>
el.innerHTML = 'item' + (myList.lastElementChild && myList.lastElementChild.textContent ? (parseNum(myList.lastElementChild.textContent) + 1 ) : 1);
<?php if(has_post_custom_meta('Desc')) : ?>
<div class="child_page_desc">
<?php echo get_post_meta($post->ID, 'Desc', true); ?>
</div>
<?php endif; ?>
<?php $desc = get_post_meta(get_the_ID(), 'Desc', true); ?>
<?php if(!empty($desc)) : ?>
<div class="child_page_desc">
<?php echo $desc;?>
</div>
<?php endif; ?>
function getQueryParameter(param) {
var url = decodeURIComponent(window.location.search.substring(1));
var urlVars = url.split('&');
var parameterName;
for (var i = 0; i < urlVars.length; i++) {
parameterName = urlVars[i].split('=');
if (parameterName[0] === param) {
return parameterName[1] === undefined ? true : parameterName[1];
}
}
};
$('select').val(getQueryParameter('style'));
$('.sub-menu_lvl1 li a').mouseenter(function() {
var classes = ['one','two','three','four','five']
$('.sub-menu_lvl2').removeClass('info-visible');
$('.sub-menu_lvl2.' + classes[ $(this).closest('li').index()]).addClass('info-visible');
});
<a href="#" data-visibleclass="one">...</a>
и тогда:$('.sub-menu_lvl1 li a').mouseenter(function() {
$('.sub-menu_lvl2').removeClass('info-visible');
$('.sub-menu_lvl2.' + $(this).data('visibleclass')).addClass('info-visible');
});
<span id="st">1</span>
<span id="pr">2</span>
<span id="box">3</span>
<span id="mox">4</span>
<span class="itog"></span>
var st= parseInt($('#st').text());
var pr= parseInt($('#pr').text());
var box= parseInt($('#box').text());
var mox= parseInt($('#mox').text());
$('span.itog').text(st+ pr + box + mox); // результат 10
$('span.itog').text('' + st + pr + box + mox); // должно получиться 1234
<div class="slide_menu" id="toggle_menu" style="left:-250px;"> .. </div>
function move() {
var toggleMenu = document.getElementById("toggle_menu");
if (!toggleMenu.style.left || parseInt(toggleMenu.style.left) < 0) {
toggleMenu.style.left = "0px";
} else {
toggleMenu.style.left = "-250px";
}
}
var texts = [];
$('a').each(function() {
if (texts.indexOf($(this).text()) == -1) {
texts.push($(this).text())
} else {
$(this).remove();
}
})
$('button.class_btn').bind('click', function () {
var action = $(this).attr('id').slice(0,-4);
sendForm(action);
});
SELECT
deps.itemid as itemid1, tradeid.itemid as itemid2
FROM
deps
LEFT JOIN
tradeid
ON
deps.tradeid = tradeid.id
SELECT
items1.name as name1, items2.name as name2
FROM
(предыдущий запрос) ids
LEFT JOIN items items1 ON items1.id = ids.itemid1
LEFT JOIN items items2 ON items2.id = ids.itemid2
$groups[] = array(1 => 'морковка',5 => 'капуста',7 => 'картошка');
$groups[] = array(100 => 'собака',200 => 'кошка',300 => 'мышка');
$groups[] = array(1000 => 'клавиатура',2000 => 'системник',3000 => 'монитор');
...
$groups[] = array(10000 => 'лаванда',20000 => 'ромашка',30000 => 'роза');
$id = 300;
foreach($groups as $group) {
if (array_key_exists($id,$group)) {
$similar_pages = '';
foreach ($group as $key=>$item) {
if ($key == $id ) continue;
$similar_pages .= sprintf('<а href="page.php?id=%d">%s< /а> ', $key, $item);
}
break;
}
}
print ($similar_pages);
SELECT
T1.consultant, count(T1.consultant) AS count, T2.unread
FROM
Messages T1
LEFT JOIN
(SELECT consultant, count(*) AS unread FROM Messages WHERE read = '0' GROUP BY consultant) T2
ON
T1.consultant = T2.consultant
GROUP BY
T1.consultant
consultant => 000010, count => 4, unread => 3
consultant => 000011, count => 1, unread => null
consultant => 000019, count => 1, unread => 1
consultant => 000034, count => 1, unread => null