Сообщение от web-expanse
|
При заполнения поля(пускай это будет "Слово") мы нажимаем на кнопку которая стоит рядом
После этого в textarea появляется следующее: Позиция 1 (Слово)
|
Как вариант...
<!DOCTYPE html>
<html>
<head>
<!--
<script src='http://code.jquery.com/jquery-latest.js'></script>
<link rel='stylesheet type=text/css href=tmp.css' />
-->
<style type='text/css'>
</style>
<script type='text/javascript'>
function ok(Obj) {
var val=Obj.parentNode.getElementsByTagName('input')[0].value;
var o=document.getElementById('text');
var dlm=(o.value=='')? '': '\n';
o.value=o.value+dlm+Obj.value+' ('+val+')';
};
</script>
</head>
<body>
<form action = "" method = "post">
<div>
<input type="text" size="2" id="text1">
<input type="button" onclick="ok(this);" value = "Позиция 1" />
</div>
<div>
<input type="text" size="2" id="text2">
<input type="button" onclick="ok(this);" value = "Позиция 2" />
</div>
<div>
<input type="text" size="2" id="text3">
<input type="button" onclick="ok(this);" value = "Позиция 3" />
</div>
<div>
<input type="text" size="2" id="text4">
<input type="button" onclick="ok(this);" value = "Позиция 4" />
</div>
<div>
<textarea id="text" value = "" rows="10" /></textarea>
</form>
</body>
</html>