试着学习新的剧本

Try to learn new script

本文关键字:学习      更新时间:2023-09-26

我的任务是为学校创建一个在线注册系统,以了解谁来了,以及一个将学生添加到mysql数据库的页面。

我需要使用javascript来显示文本区域,并使文本区域在单击旁边的编辑按钮之前不可更改,一旦单击按钮,我需要更改值,如done,单击后将使其再次不可更改。这是jsfiddle:

JSFiddle

代码:

<div id="addstudents">
    <form>
    Students Full Name:<input type="text" name="fullname"><input type="button" value="edit"><br>
    Students Form: <select name="form">
    <option value="No">No</option>
    <option value="Yes">Yes</option>
    </select><input type="button" value="edit"><br>
    Students Tutor Name: <input type="text" name="lastname"><input type="button" value="edit"><br>
    Students Tutor Name: <input type="text" name="TutorName"><br>
    Disability: <select name="disability">
    <option value="No">No</option>
    <option value="Yes">Yes</option>
    </select><br>    
        <p>All the fields need to be locked until the edit button beside them is clicked. When the value of the disability is changed i need to text area to apear. All of this need to be done in java script.</p>
    </form>    

        </div>
    <div id="menu">
    this will be the menu area
    </div>

1给输入一个id,如下所示:

 <input id="blah" readonly="true">

稍后您将需要id。并使其只读。

2将按钮连接到如下代码:

<input type="button" onclick="makeEditable()">

3写一些代码:

function makeEditable() {
    var text = document.getElementById("blah") //Id in step 1
    text.readonly = "false" //make it editable - see link
}

给你!