Javascript文本框

时间:2012-04-24 13:46:51

标签: javascript visual-studio

您好我已经使用java脚本插入了一个文本框,旁边是删除按钮符号。

现在我必须在该文本框中实现一些逻辑来保存文本readed数据。请问你能告诉我怎么可能?

testTypeNode.Text = testTypeNode.Text & "" & _
    " <img src=""../images/delete_16x.ico""" & _
    " style=""text-align:bottom; cursor:pointer;"" alt=""Delete TestType""" & _
    " title=""Delete TestType"" onclick=""javascript:if(confirm('Are you sure you want to delete? Any running tests will be aborted!'))" & _
    " {" & ClientScript.GetPostBackEventReference(btnDeleteTestType, "" & sequenceNode.Value.ToString & _
    WordSeparationChar & testTypeNode.Value.ToString & "") & ";};"" />" & _
    " <input type = ""text"" id = ""txtExperimentalStressdays"" name =""ExperimentalStressdays"" size = ""4"" title=""Please enter the Experimental Stressdays"" javascript:onfocusdown(/>"

1 个答案:

答案 0 :(得分:0)

确定。我会在这里猜测一下。
将此代码复制到 page.html ,并告诉我们您是否正在寻找这样的代码。

<html>

<head>
    <script src="http://code.jquery.com/jquery.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(window).load(function(){
            $('#btncopy').on('click', function(){
                $('#txt2').val( $('#txt1').val() );
            });

            $('#btndelete').on('click', function(){
                $('#txt1').text('');
            });
        });
    </script>
</head>

<body>
<p>
    <div id="divform">
        <form class="myform">
            <textarea id="txt1">Here is the text the you want to copy.</textarea> 
        </form>
        <button id="btndelete">delete</button>
        <button id="btncopy">copy</button>
    </div>
</p>
<p>
    <div id="divclone">
        clones: 
        <form id="formclone">
            <textarea id="txt2">The text will be copied here.</textarea> 
        </form>
    </div>
</p>
</body>

</html>

修改

抓一点。我刚看到你的评论。

  

Amit Bhargava,我想阅读用户从文本输入的文字   框并将其保存到数据库中。请帮帮忙?