Наработки

Автор: in_construct Написано: 1 г. назад Форматирование: text.
С нумерацией строк
<form action="somescript.php?do=somedo" method="post">
<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" />

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
        <td class="tcat">
                <if condition="$show['editpoll']"><span class="smallfont" style="float:$stylevar[right]"><a href="poll.php?$session[sessionurl]do=polledit&amp;pollid=$pollinfo[pollid]">$vbphrase[edit_poll]</a></span></if>
                $vbphrase[poll]<span class="normal">: $pollinfo[question]</span>
        </td>
</tr>
<if condition="$show['pollenddate']">
<tr>
        <td class="thead" align="center" style="font-weight:normal"><phrase 1="$pollenddate" 2="$pollendtime">$vbphrase[this_poll_will_close_on_x_at_y]</phrase></td>
</tr>
</if>
<tr>
        <td class="panelsurround" align="center">
        <div class="panel">
                <div style="width:$stylevar[formwidth]" align="$stylevar[left]">

                        <if condition="$show['publicwarning']">
                        <div class="fieldset">$vbphrase[public_poll_users_see_choices]</div>
                        </if>

                        <fieldset class="fieldset">
                                <legend>$vbphrase[poll_options]</legend>
                                <div style="padding:$stylevar[formspacer]px">
                                        <div style="margin-bottom:$stylevar[formspacer]px"><strong>$pollinfo[question]</strong></div>
                                        Invited people with friends
                                </div>
                        </fieldset>

                        <div>
                                <script type="text/javascript">
                                <!--
function add_guest_field()
{
        var cont = YAHOO.util.Dom.get("guestsfields"), childs = YAHOO.util.Dom.getChildren("guestsfields");
        if (cont.parentNode.style.display == "none")
        {
                cont.parentNode.style.display = "block";
                return false;
        }
        var li = document.createElement("li");
        li.innerHTML = childs[0].innerHTML.replace(/\[0\]/g, "[" + childs.length + "]");
        cont.appendChild(li);
        return false;
}
function remove_guest_field(obj)
{
        obj = obj.parentNode;
        var c = YAHOO.util.Dom.getChildren("guestsfields"), i, j;
        for(i = 0; i < c.length; i++)
        {
                if (obj === c[i]){
                        for(j = i + 1; j < c.length; j++)
                        {
                                c[j].innerHTML = c[j].innerHTML.replace(new RegExp("\\[" + j + "\\]", "gm"), "[" + (j - 1) + "]");
                        }
                        break;
                }
        }
        obj.parentNode.removeChild(obj);
        return false;
}
                                -->    
                                </script>
                                <a href="javascript://" onclick="fetch_object('guestsfields').style.display = 'none'; fetch_object('meetselfadd').style.display = fetch_object('guestsfields').parentNode.style.display = '';">Добавить себя</a> | <a href="javascript://" onclick="add_guest_field();">Добавить гостя</a>
                                <div style="display: none;">
                                        <ol id="guestsfields">
                                                <li>
                                                        Имя: <input type="text" name="name[0]" value="" />&nbsp;<select name="sex[0]"><option value="">Пол</option><option value="m">Мальчик</option><option value="v">Девочка</option></select>&nbsp;<select name="age[0]"><option value="">Возраст</option><option value="0">0-3</option><option value="1">4-6</option><option value="2">7-9</option><option value="3">10-13</option><option value="4">13-17</option><option value="5">18+</option></select>&nbsp;<a href="javascript://" onclick="remove_guest_field(this);">удалить</a><br />
                                                        <label for="meeting_an"><input type="checkbox" id="meeting_an" name="animal[0]" value="1" />C животным</label>&nbsp;<label for="meeting_al"><input type="checkbox" id="meeting_al" name="alco[0]" value="1" />C алкоголем</label>&nbsp;<label for="meeting_on"><input type="checkbox" id="meeting_on" name="overnigth[0]" value="1" />C ночевкой</label>&nbsp;
                                                </li>
                                        </ol>
                                        <div id="meetselfadd" style="display: none;">
                                                <select name="sex[0]"><option value="">Пол</option><option value="m">Мальчик</option><option value="v">Девочка</option></select>&nbsp;<select name="age[0]"><option value="">Возраст</option><option value="0">0-3</option><option value="1">4-6</option><option value="2">7-9</option><option value="3">10-13</option><option value="4">13-17</option><option value="5">18+</option></select><br />
                                                <label for="meeting_an"><input type="checkbox" id="meeting_an" name="animal[0]" value="1" />C животным</label>&nbsp;<label for="meeting_al"><input type="checkbox" id="meeting_al" name="alco[0]" value="1" />C алкоголем</label>&nbsp;<label for="meeting_on"><input type="checkbox" id="meeting_on" name="overnigth[0]" value="1" />C ночевкой</label>
                                        </div>
                                        <input type="hidden" name="do" value="self" />
                                        <input type="submit" class="button" value="Добавить" />
                                </div>
                        </div>
                </div>
        </div>
        </td>
</tr>
</table>

</form>