如何设置表单action属性 [英] How to set form action attribute

查看:218
本文介绍了如何设置表单action属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚更新了我的ASP.NET应用程序从.NET 3.5至4.0。导航时其中一个重大更改是表单动作的属性是空的到根文件夹,而不是previously自动捡Default.aspx的。

I have just updated my ASP.NET application from .NET 3.5 to 4.0. One of the breaking changes is the form action attribute is empty when navigating to the root folder, instead of previously automatically picking up default.aspx.

塞汀在标记或action属性的code-后面不起作用的action属性仍然是空的时,该页面的呈现方式。

Seting the action attribute in markup or in the code-behind doesn't work as the action attribute is still empty when the page is rendered.

标记:<形式ID =MyForm的=服务器行动=的Default.aspx>

Markup: <form id="MyForm" runat="server" action="default.aspx">

code:Me.Page.Form.Action =的Default.aspx

Code: Me.Page.Form.Action = "default.aspx"

使用jQuery加上就绪事件的动作做的工作。

Using jQuery to add the action on the ready event does work.

        $(document).ready(function() {
            $('#MyForm').attr("action","default.aspx");
        });

难道还有其他的解决办法吗?

Is there another solution?

推荐答案

您应该尝试:     $('表')得到('MyForm的')的setAttribute('行动','Default.aspx的)。

You should try : $('form').get('MyForm').setAttribute('action', 'default.aspx');

这篇关于如何设置表单action属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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