JavaScript,HTML - 是否可以在Javascript Confirm Box中显示值Html.TextAreaFor?

时间:2010-08-20 17:08:05

标签: javascript html

我正在尝试在Javascript确认框中显示Html.TextAreaFor的值但我的代码不起作用。也许有人知道如何解决它..

这是我的代码:

<% using (Html.BeginForm())
           { %>
        <%= Html.Hidden("ThreadId", Html.Encode(this.Model.ThreadId))%>
        <%= Html.TextAreaFor(m=>m.Quote,7,40,null)%>
        <br /> <button name="view" value="ViewQuoteButton" onclick="return ViewQuote()">
            View
        </button>
        <% } %>

 <script type="text/javascript">

        function ViewQuote() {

            if (confirm(document.valueOf( "here I'trying to show value of TextAreaFor"))) {

                return true;
            }
            else {
            } return false;
        }
    </script>

谢谢大家,保重, Ragims

1 个答案:

答案 0 :(得分:0)

document.getElementById("Quote").val();

OR

document.getElementByName("Quote").val();