Показать сообщение отдельно
  #4 (permalink)  
Старый 19.07.2011, 22:21
Интересующийся
Отправить личное сообщение для kazimira6 Посмотреть профиль Найти все сообщения от kazimira6
 
Регистрация: 15.02.2011
Сообщений: 12

Благодаря trikadin, получилось то, что хотела реализовать. Не судите строго, я пока мало знаю.) И код, который получился - очень не красивый!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
	"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<head>
<title>Animation Javascrip</title>
<style type="text/css">
#wrapper{width:600px; margin:0 auto; background:#dedede; position:relative;}
.cube{width:1px; height:1px; background:#000000; position:absolute; left:0;}
</style>

</head>
<body>
<div id="wrapper">
<form id="num" action="" method="">
<input type="text" name="field" />
<input type="button" value="вперед" id="but" />
</form>
<script type="text/javascript">
function createObj(element) {
	this.create = function(bgColor, posL, posT){
	cube = document.createElement("div");
	cube.className = "cube";
	if(bgColor){cube.style.backgroundColor=bgColor;}
	if(posL){cube.style.left=posL;}
	if(posT){cube.style.top=posT;}
	document.body.appendChild(cube);
	}
}
but = document.getElementById("but");
	but.onclick = function(){
	numV = Math.round(document.getElementById("num").field.value);
	var createOne = new createObj();
	for(var i=0; i<numV; i++){
	createOne.create("blue", (i/2+"px"), i+"px")
	}
}
</script>
</div>
</body>


На форуме очень много умных разработчиков, может кто-нибудь подскажет, как его улучшить. Заранее спасибо...)

Последний раз редактировалось monolithed, 19.07.2011 в 23:28.
Ответить с цитированием