繁体   English   中英

从ASPX页面到HTML页面的价值转移

[英]Transfer of value from aspx page to HTML page

我有一个控制页面,在该页面上可以设置要控制的某些参数。 该页面以aspx格式显示,当我单击“提交”时,我希望该数据位于.htm页面的textbox 如在html中,我没有C#文件,那么该怎么办?

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<iframe src="http://10.112.90.131/index.htm" border="0" frameborder="0" height="600" width="800"></iframe>

</asp:Content>

我认为您应该使用aspx页面而不是html,尽管您可以通过aspx将值通过查询字符串转换为html并通过JQuery / JavaScript解析查询字符串。

假设下面是从aspx页面打开HTML页面的查询字符串。

http://stackoverflow.com/ShowData.htm?firstname=jhon

现在,远程html上的JQuery / JavaScript代码将是:-

   $(function () {
       //Setting textbox value to jhon as per querystring
      $("#SomeTextBoxID").val(getParameterByName("firstname"));
    }
    function getParameterByName(name) {
        name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
        var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
        results = regex.exec(location.search);
       return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
    }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM