Jump to content
  • 0

Текст в форме


phreaker33
 Share

Question

10 answers to this question

Recommended Posts

  • 0

Если я правильно понимаю, нужно каждому элементу таблицы прописыпать Id и создавать условие?

Да. А можно и так:

table tr:nth-child(2) td:nth-child(3) input

Где 2 и 3 - координаты ячейки. Отсчёт ведёт с первой, а не с нулевой!

Edited by afdw
Link to comment
Share on other sites

  • 0
Вот код формы:
<div class="modal" id="modal"><div><div class="text"><h3>Обслуживание 1С</h3><form action="sendPrajm.php" method="post"><input name="name" placeholder="Имя" size="38px" type="text" value="" /><br /><br /><input name="email" placeholder="E-mail" size="38px" type="text" value="" /><br /><br /><input name="phone" placeholder="Телефон" size="38px" type="text" value="" /><p>не забудьте указать в заявке название желаемого тарифного плана</p><textarea cols="34.5" name="body" placeholder="Дополнительная информация" rows="10" style="resize: none"></textarea><br /><br /><button type="submit">Отправить</button><button type="reset">Отменить</button><p></p></form></div><a href="#close" title="Закрыть">Закрыть</a></div></div>

Вот код таблицы:

<table align="center" width="95%">	<tbody>		<tr>			<td id="min"><a class="button openModal" href="#modal"></a></td>			<td></td>			<td id="opt"><a class="button openModal" href="#modal"></a></td>			<td></td>			<td id="loyal"><a class="button openModal" href="#modal"></a></td>			<td></td>			<td id="unlim"><a class="button openModal" href="#modal"></a></td>		</tr>		<tr>		</tr>	</tbody></table>document.querySelector("td").onclick = function()

Я в яваскрипт совсем не шарю, помогите исправить скрипт

document.querySelector("td").onclick = function(){    var min = document.getElementById('min');    var opt = document.getElementById('opt');    var loyal = document.getElementById('loyal');    var unlim = document.getElementById('unlim');for (table tr:nth-child(2) td:nth-child(3))input {     document.querySelector("min").value = "textmin";    document.querySelector("opt").value = "textopt";    document.querySelector("loyal").value = "textloyal";    document.querySelector("unlim").value = "textunlim";}};
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy