Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/76.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 未弃用的等价物<;表单目标="&引用&燃气轮机;_Html_Dom_Xhtml_Forms - Fatal编程技术网

Html 未弃用的等价物<;表单目标="&引用&燃气轮机;

Html 未弃用的等价物<;表单目标="&引用&燃气轮机;,html,dom,xhtml,forms,Html,Dom,Xhtml,Forms,我想达到和…一样的目标 window.open('lalala.php', 'lalala', '...'); 但是我想发送一个HTTP POST请求,而不是HTTP GET请求。因此,我使用以下方法: $('<form/>').attr('action', 'lalala.php') .attr('target', 'lalala') // w3schools.org says this is deprecated .at

我想达到和…一样的目标

window.open('lalala.php', 'lalala', '...');
但是我想发送一个HTTP POST请求,而不是HTTP GET请求。因此,我使用以下方法:

$('<form/>').attr('action', 'lalala.php')
            .attr('target', 'lalala')      // w3schools.org says this is deprecated
            .attr('method', 'post')
            .append(hiddenParam('param1', param1))
            .append(hiddenParam('param2', param2))
            .submit().remove();

// hiddenParam is a function I created that returns an input tag
// the type attribute set to hidden,
// the id attribute set to the first parameter,
// and the value attribute set to the second parameter
$(''.attr('action','lalala.php'))
.attr('target','lalala')//w3schools.org说这是不推荐的
.attr('method','post')
.append(hiddenParam('param1',param1))
.append(hiddenParam('param2',param2))
.submit().remove();
//hiddenParam是我创建的一个函数,它返回一个输入标记
//类型属性设置为隐藏,
//设置为第一个参数的id属性,
//以及设置为第二个参数的值属性
但是,
target
属性不推荐使用。有没有什么方法可以通过不推荐的方式来实现我的目标

  • target
    仅在严格的doctype中丢失。它没有被弃用。最简单的解决方案是使用过渡doctype
  • 我所知道的所有浏览器都做了正确的事情,即使您使用了严格的doctype
  • 如果必须使用严格的doctype,并且非常关心验证,则可以扩展doctype定义:
  • 只是要知道。解决方案是将XHTML作为
    应用程序/XHTML+xml
    提供,但这会导致IE崩溃,因此您需要在确定内容类型之前嗅探该浏览器。它本质上是对验证表单上的一个小复选框的一个巨大攻击。只使用过渡doctype通常要简单得多

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" [ <!ATTLIST form target CDATA #IMPLIED> ]>
    

    使用
    目标
    -它没有被弃用

    添加

    <form target="lalala" ...></form>
    
    
    
    目标
    在任何地方都不会被弃用。它只是没有出现在严格的doctype中。
    []
    做什么?@Eduardo理论上,它告诉浏览器在
    元素上有一个额外的属性,叫做target。实际上,它会导致你的浏览器呕吐(除非你碰巧在使用Opera)。@Eduardo这是标准的DTD语言。如果您真的去
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
    你会看到各种类似的说法。@Matthew:我不可能把这些都讲一遍,不过还是要谢谢你!(我不知道为什么fairies不编写一个在所有操作系统上运行的符合标准的浏览器…)不要总是相信w3schools除非你看到来自可靠来源的支持证据,否则绝对不相信w3schools。那么,哪个来源可靠?(顺便说一句,W3C可以起诉这个W3C吗?)。更多信息:这将针对一个新的、未命名的窗口,而不是使用特定参数打开的窗口。这些人说它是:。但是他们使用ASP,所以他们不会是认真的,对吧?他们错了(像往常一样:)我建议您在不推荐的列中为目标属性在中找到一个D,或者在任何其他官方规范中找到一个引用。谢谢。尽管承认我从w3schools.org学到了关于Web开发的所有知识让我觉得自己很愚蠢。@Floern-“不存在”和“不推荐”是两码事。他们之间没有1:1的相关性。@Liam-他们把事情从“纯粹的恐怖”变成了“漂亮的垃圾”。最好还是避免。