Метка

javascript

Всего: 139 записей

setTimeout click

function AutoPlayLink(right,left,count) {
	var	right=document.getElementById(right);
	var	left=document.getElementById(left);
	setInterval(function() {
		for (i=0;i<=count;i++) {
			setTimeout(right.click(),10000);
		}
		for (i=0;i<=count;i++) {
			setTimeout(left.click(),10000);
		}
	},5000);
}
$(document).ready(function(){
	AutoPlayLink('link_right','link_left',2);
});

javascript: выбрать option по value

В примере в select выбираем option c нужным value (id — необходимое значение)

function InlineForm(id) {
	var poluch=document.getElementById('poluch');
	var poluch_o=poluch.options;
	$("#poluch").find("option").removeAttr("selected");
	for (i=0;i<poluch_o.length;i++) {
		if (poluch_o[i].value==id) {
			poluch[i].setAttribute("selected","selected");
			poluch[i].selected=true;
		}
	}
}