开发者

Dojo: Why an extra text box is produced?

The following part of code produces this result in Firefox and Chrome

Dojo: Why an extra text box is produced?

<html>
    <title>Dojo Example</title>
    <script src="http://ajax.googleapis.com/ajax/libs/dojo/1.6.0/dojo/dojo.xd.js" 
    djConfig="parseOnLoad: true">
    </script>
    <script type="text/javascript"> 
    dojo.require("dojo.parser");
    dojo.require("dijit.form.ValidationTextBox")
    </script>
    <label for="firstName"> First Name: </label>
    <input type="text" id="firstName"
    dojoType="dijit.form.ValidationTextBox"
    promptMessage="Enter first name:"
    invalidMessage="First Name is required"
    />
</html>

An extra text box is produced with text "X" on it. I have no idea how to fix it and why does this happen. Anyone can 开发者_如何学JAVAhelp?


You need to add a valid dijit theme to the body tag of your html document, in addition to including a to the css stylesheet of the theme you want to use.

for example:

<html>
    <head>    
        <title>Dojo Example</title>
        <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dijit/themes/claro/claro.css">
        <script src="http://ajax.googleapis.com/ajax/libs/dojo/1.6.0/dojo/dojo.xd.js" 
            djConfig="parseOnLoad: true">
        </script>
        <script type="text/javascript"> 
            dojo.require("dojo.parser");
            dojo.require("dijit.form.ValidationTextBox")
        </script>
   </head>
   <body class="claro">
        <label for="firstName"> First Name: </label>
        <input type="text" id="firstName"
            dojoType="dijit.form.ValidationTextBox"
            promptMessage="Enter first name:"
            invalidMessage="First Name is required"
        />
   </body>
</html>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜