怀疑文本框添加div内容 [英] Doubts on textbox to add in div content

查看:44
本文介绍了怀疑文本框添加div内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<div id="ListInvite" style="width: 255px; height: 100px; overflow: scroll; border: 1px solid black;">
   <asp:TextBox ID="getemail" runat="server" Width="255px" ></asp:TextBox>
   <asp:CheckBoxList ID="chkBxToInvite" runat="server"></asp:CheckBoxList>
</div>

< br $> b $ b



从上面的代码中,我有一个div标签。使用CheckboxList我可以将新的选中列表项添加到div中。

如果我在文本框中输入电子邮件ID并按回车键,它应该添加到div内容中并使用div标签中列出的邮件ID自动发送邮件。



从下面的评论复制的其他内容

我应该能够在文本框中键入文本(电子邮件)当按下输入键时,它应该添加div内容并且还自动发送电子邮件到div内容中列出的那些邮件ID




From the above code, I've a div tag. Using CheckboxList I can add new checked list items into div.
If I enter email id in textbox and press enter, it should add into div content and shuld send mail automatically using the mail id's listed in div tag.

additional conten copied from comment below
I should able to type text(email) in textbox and when pressed enter key, it should add in div content and also shuld automatically send emails to those mail id's listed in div content

推荐答案

<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <title></title>
</head>
<body>
    <input id="idEmail" type="email" /><input id="idAdd" type="button" value="add" onclick="addEmail(); return false;" />
    <br />
    invite list...
    <div id="idList">

    </div>

    <script type="text/javascript">
        function addEmail()
        {
            if (idEmail.value != null && idEmail.value != '')
            {
                var checkbox = document.createElement("input");
                var description = document.createTextNode(idEmail.value);

                checkbox.type = "checkbox";
                checkbox.name = "idChk" + idList.children.length;
                checkbox.value = idEmail.value;
                checkbox.checked = true;

                window.open('mailto:' + idEmail.value);

                idList.appendChild(checkbox);
                idList.appendChild(description);
                idList.appendChild(document.createElement("br"));
            }
        }
    </script>
</body>
</html>





您必须知道不能从JavaScript发送任何电子邮件。提供的代码将打开客户端的默认电子邮件客户端...



You have to know that no email can be send from JavaScript. The provided code will open the default email client for the client...


这篇关于怀疑文本框添加div内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆