File "editor_button.html"

Full Path: /home/analogde/www/private/templates/common/editor_button.html
File size: 2.57 KB
MIME-type: text/html
Charset: utf-8

<html>
<head><title>Button</title>
<style><%include editor_dialog.css%></style>
<script>

var name, value, initial, tab;
function initDialog() {
    name  = document.getElementById('name');
    value = document.getElementById('value');
    tab   = document.getElementById('tab');
    type  = document.getElementById('type');
}

function done () {
/* ---------------------------------------------------------
 * When the user hits done this fucntion is called to 
 * produce the html from the div tags. It then inserts
 * it into the edit window and closes this window.
 */    
    var html = '<input';
    if (name.value) 
        html += ' name="' + name.value + '"';
    if (value.value) 
        html += ' value="' + value.value + '"';
    if (tab.value) 
        html += ' tabindex="' + tab.value  + '"';
    html += ' type=';
    if (type.value == 2) {
        html += '"reset"';
    }
    else if (type.value == 1) {
        html += '"submit"';
    }
    else {
        html += '"button"';
    }
    html += '>';
    
    opener.dialogWindow.returnFunc(html);
    window.close();
}

function check_type (title, val) {
/* ---------------------------------------------------------
 * When the type radio is changed this is called to see if
 * the value in the Value/label field should be changed.
 */
    value.value = title;
    type.value  = val
}

</script>
<body class=body onload="initDialog()">
<table border=0 cellpadding=3 align=center>
    <tr class="td">
        <td>Name:</td><td><input id=name size=30></input></td>
    </tr>
    <tr class="td">
        <td>Value/label:</td><td><input id=value size=30 value="Button"></input></td>
    </tr>
    <tr class="td">
        <td>Button type:</td>
        <td>
            <table border=0>
                <tr class="td">
                    <td>
                        <input type=radio id=type name=type onclick="check_type('Button', '0');" value="0" checked> Normal
                    </td>
                    <td>
                        <input type=radio id=type name=type onclick="check_type('Submit', '1');" value="1"> Submit
                    </td>
                    <td>
                        <input type=radio id=type name=type onclick="check_type('Reset', '2');" value="2"> Reset
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    <tr class="td">
        <td>Tab order:</td><td><input id=tab size=3></td>
    </tr>
</table>
<hr>
<div align=right>
    <button class=button onclick="done();">OK</button> &nbsp;
    <button class=button onclick="window.close();">Cancel</button>&nbsp;
</div>
</body>
</html>