简体   繁体   English

dojo dijit.form.ValidationTextBox问题

[英]Issue with dojo dijit.form.ValidationTextBox

The following XHTML code is not working: 以下XHTML代码无效:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" type="text/css" href="/dojotoolkit/dijit/themes/tundra/tundra.css" />
    <link rel="stylesheet" type="text/css" href="/dojotoolkit/dojo/resources/dojo.css" />
    <script type="text/javascript" src="/dojotoolkit/dojo/dojo.js" djConfig="parseOnLoad: true" />
    <script type="text/javascript">
        dojo.require("dijit.form.ValidationTextBox");
        dojo.require("dojo.parser");
    </script>
</head>

<body class="nihilo">
    <input type="text" dojoType="dijit.form.ValidationTextBox" size="30" />
</body>

</html>

In Firebug I get the following error message: 在Firebug中,我收到以下错误消息:

[Exception... "Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER) [nsIDOMNSHTMLElement.innerHTML]" nsresult: "0x80004003 (NS_ERROR_INVALID_POINTER)" location: "JS frame :: http://localhost:21000/dojotoolkit/dojo/dojo.js :: anonymous :: line 319" data: no] http://localhost:21000/dojotoolkit/dojo/dojo.js Line 319 [例外...“组件返回失败代码:0x80004003(NS_ERROR_INVALID_POINTER)[nsIDOMNSHTMLElement.innerHTML]”nsresult:“0x80004003(NS_ERROR_INVALID_POINTER)”location:“JS frame :: http:// localhost:21000 / dojotoolkit / dojo / dojo。 js :: anonymous :: line 319“data:no] http:// localhost:21000 / dojotoolkit / dojo / dojo.js第319行

Any idea what is wrong? 知道什么是错的吗?

The problem seams to be the ending of the file... 问题接缝是文件的结尾......

The diverence between the two seams to be the Content-Type in the response header from apache. 两个接缝之间的偏差是apache响应头中的Content-Type。

  • For .html it is Content-Type text/html; 对于.html,它是Content-Type text / html; charset=ISO-8859-1 字符集= ISO-8859-1
  • For .xhtml it is Content-Type application/xhtml+xml 对于.xhtml,它是Content-Type application / xhtml + xml

The problem is that innerHTML is an unofficial property that is not part of the W3C specifications, and thus may or may not work depending upon the browser, especially when the page is being rendered as a XHTML file rather than a HTML file. 问题是innerHTML是一个非官方属性,不属于W3C规范的一部分,因此可能会或可能不会取决于浏览器,特别是当页面呈现为XHTML文件而不是HTML文件时。 See here and here . 看到这里这里

Where you import dojo.js: 您导入dojo.js的位置:

<script type="text/javascript" src="/dojotoolkit/dojo/dojo.js" djConfig="parseOnLoad: true"/>

It should be: 它应该是:

<script type="text/javascript" src="/dojotoolkit/dojo/dojo.js" djConfig="parseOnLoad:true"></script>

Have fun with dojo, it's can do some cool stuff. 与道场玩得开心,它可以做一些很酷的东西。

Brian Gianforcaro Brian Gianforcaro

There are some similar tickets on the dojo trac page: 在dojo trac页面上有一些类似的票:

http://trac.dojotoolkit.org/search?q=xhtml+ns_error&noquickjump=1&ticket=on http://trac.dojotoolkit.org/search?q=xhtml+ns_error&noquickjump=1&ticket=on

Probably you are facing a bug and you will need to fill a new ticket. 可能你遇到了一个错误,你需要填写一张新票。

那么,dojo.js在319行做什么?

Are you sure your pointing to the right path in the script tags? 您确定指向脚本标记中的正确路径吗?

I put it up on the web, check it out. 我把它放在网上,检查一下。

The left is Dojo parsed input, the right is an regular old input. 左边是Dojo解析输入,右边是常规旧输入。 Link 链接

I'm on OS X, using firefox 3.0.1 I get no errors under firebug. 我在OS X上,使用firefox 3.0.1我在firebug下没有错误。

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

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