提交表单中的值

时间:2012-04-24 22:38:13

标签: css forms

我创建了一个RSS提交表单,我想在输入框中显示类似Enter your email here....的内容,当他们点击它时,该消息应该消失,他们可以将他们的电子邮件放在框中。 / p>

这是我目前正在使用的代码

<div id="RSS">
        <form action="http://feedburner.google.com/fb/a/mailverify" class="RSS" method="post" target="popupwindow" onsubmit="window.open('http://feedburner.google.com/fb/a/mailverify?uri=RSS', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true">
            <input type="hidden" name="uri" value="RSS">
            <input type="hidden" name="loc" value="en_US">
            <input name="email" id="RSS-text" type="text" maxlength="100" style="width:160px !important" value="Enter your email address..." class=""><button type="submit" id="RSS-button">Subscribe</button>
        </form>
    </div>

问题是当有人点击它时它不会消失,我看到很多表格,包括我的搜索表单,可以这样做。

1 个答案:

答案 0 :(得分:2)

您可以使用占位符属性,但它不支持IE:

<input type="text" placeholder="Enter your text here..." />

否则你可以使用一些javascript:

<input type="text" onfocus="if(this.value=='Enter your text here...') this.value='';" onblur="if(this.value=='') this.value='Enter your text here...';" value="Enter your text here..." />