HTML5 给input和textarea HTML标签增加 prompt

andyhu00 2011-10-26

下面的例子展示了,如何给INPUT和TEXTAREA标签通过设置attribute。

<!DOCTYPE html>
<html>
<body>
 
    <table>
        <tr>
            <th>Username:</th>
            <td><input id="usrnm" type="email" name="username" placeholder="user@domain.com" /></td>
        </tr>
        <tr>
            <th>Password:</th>
            <td><input id="psswd" type="password" name="password" placeholder="Top secret password" /></td>
        </tr>
        <tr>
            <th>Comments:</th>
            <td><textarea id="cmmnts" cols="30" rows="5" placeholder="Comments"></textarea></td>
        </tr>
        <tr>
            <td>&nbsp;</td>
            <td><input id="submitBtn" type="submit" value="Submit" /></td>
        </tr>
    </table>
 
</body>
</html>

 源码下载:

prompttext.zip

相关推荐

崔博伦一路有你 / 0评论 2013-04-09