Показать сообщение отдельно
  #6 (permalink)  
Старый 22.08.2008, 13:12
Флудер
Отправить личное сообщение для ZoNT Посмотреть профиль Найти все сообщения от ZoNT
 
Регистрация: 25.07.2008
Сообщений: 1,271

function mousedown(e) {
    e = e||window.event;
    obj = e.srcElement||e.target;
}
 
function mousemove(e) {
    e = e||window.event;
    if (window.obj) {
       obj.style.left = e.clientX + document.body.scrollLeft;
       obj.style.top = e.clientY + document.body.scrollTop;
       return false;
    }
}
 
function mouseup() { 
	obj = null;
}
 
function create_control() {
   var temp=window.prompt('Введите имя создаваемого элемента','');
   if((temp!='') && (temp!=null)) {
        var elem=document.getElementById("choose_element");
        var e;
        switch (elem.selectedIndex) {
            case 0:
					e=document.createElement('select');
                break;
            case 1:
					e=document.createElement('input');
					e.setAttribute("type","checkbox");
                break;
           case 2:
					e=document.createElement('input');
					e.setAttribute("type", "submit");
                break;
           case 3:
					e=document.createElement('input');
					e.setAttribute("type", "text")
                break;
            case 4:
					e=document.createElement('input');
					e.setAttribute("type", "radio");
                break;
            case 5:
                    e=document.createElement('textarea');
        }
		e.setAttribute("name", temp);
		e.style.position = 'absolute';
		document.body.appendChild(e);
	}
}
 
document.onmousedown = mousedown;
document.onmousemove = mousemove;
document.onmouseup = mouseup;
Ответить с цитированием