Jump to content
php.lv forumi
  • 0

input field novietojums


chainjix

Question

Tātad ar JS palīdzību iekš html lapas tiek pievienotas pogas, ar kurām var pievienot un noņemt ievades laukus (vairākus).

Viss lieliski strādā, tikai ievades lauki parādās virs pogām, nevis zem tām. Kā ar JS var norādīt lauku atrašanās vietu lapā??

Kods:

<!-- POGAS PAPILDUS -->

<script language="javascript">
fields = 0;
function addInput() {
if (fields != 5) {
document.getElementById('text').innerHTML += "<input type='' value='' name='field[]' size='24' />";
fields += 1;
} 
}
</script>
<p>
<div id="text"></div>
</p>
<p>
<td><input type="button" onclick="addInput(),addErase()" name="add"
	value="Pievienot ievades lauku" /></td>
</p>
<div id="text"></div>

<!-- DZĒŠANA -->
<script language="javascript">
field = 0;
function addErase() {
if (field != 1) {
document.getElementById('erase').innerHTML += "<input type='button' onclick='reset()' value='Nodzēst ievadīto tekstu' />";
field += 1;
}
}
// Turpinājums
</script>
<td>
</head>
<!-- <tr> <td> --> <input type="submit" value="Noņemt laukus" />
<div id="erase"></div>
</td>
</table> 

pat noliekot function add input pašā apakšā, tie ievades lauki parādās virs pogām. varbūt kaut kur ir kļūda? :)

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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.

Loading...
×
×
  • Create New...