在HTML语言中表单的action属性是什么意思

html-css085

在HTML语言中表单的action属性是什么意思,第1张

在HTML语言中表单的action属性意思是规定当提交表单时,向何处发送表单数据。

action定义和用法:

action 属性可设置或返回表单的 action 属性。

action 属性定义了当表单被提交时数据被送往何处。

语法:

formObject.action=URL

扩展资料

Html.Action的优点,就是可以按照不合的场景选择不合的用户控件。

比如:

@Html.Action("UserInfoControl")在对应的UserInfoControl这个Action中,在用户未登录的时辰,可以retun PartialView("LogOnUserControl")

登录后,可以retun PartialView("UserInfoControl")

1. html.ActionLink生成一个<a href=".."></a>标记。。

例如:

@Html.ActionLink(“链接文本”、“someaction”、“somecontroller”,new { id = " 123 " },null)

生成:

<a href = " / somecontroller / someaction / 123 " >链接文本</a>

2.而Url.Action只返回一个url

Url.Action(“someaction”、“somecontroller”,new { id = " 123 " })

生成:

/ somecontroller / someaction / 123

3、Html.Action可以执行一个控制器的action,并将返回结果作为html string。

action就是表单提交的地址,比如我有一个表单,是提交留言:

index.html:

<form

action='gbook.php'

method='post'>

这句代码的含义就是将表单的信息提交给gbook.php这个程序中,这样的话我们就可以在gbook.php中写留言的处理语句,比如存入数据库等。