English 中文(简体)
利用XUL和JSON, JSON。 职衔不可行
原标题:Using XUL and JSON, JSON.Parse function do not work
  • 时间:2012-01-12 04:52:52
  •  标签:
  • json
  • xul

我愿利用XUL和JSON:

<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window id="yourwindow" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:h="http://www.w3.org/1999/xhtml">

<button value="click" oncommand="jsonTest()" />
<script type="text/javascript">
<![CDATA[
// put some js code here

function jsonTest(){

var funcionarios = 
    {
        "Marconildo":
        {
            "url": "http://www.google.com.br/",
            "idade": 34
        }
};

var funcionario = JSON.parse(funcionarios);

alert(funcionario.Marconildo);


}

]]>
</script>
</window>

但它并不发挥作用......什么是错的? JSON.parse? 我是否进口一些名称空间来利用这一功能?

最佳回答

你不需要使用JSON。 页: 1 JSON物体。 警示。 Marconildo.url

这里是联合金融公司。

http://jsfiddle.net/BZ2gk/。

问题回答

暂无回答




相关问题
JQuery/MVC Search Issue

I have inherited a piece of work where the entry screen shows a summary of 20 calculated variables. E.g. Var A (250), Var B (79). Clicking on any of these links takes the user to a view with a ...

jQuery quicksearch plug-in tinkering with JSON

I ve implemented the quicksearch plugin by Rik Lomas and I love it for an application in a custom CMS I m building. I was wondering though, since I m going to have a bizillion items in the table if ...

JSON with classes?

Is there a standardized way to store classes in JSON, and then converting them back into classes again from a string? For example, I might have an array of objects of type Questions. I d like to ...

PHP json_decode question

i m trying to use json_decode to combine a few json objects and then re-encode it. my json looks like: { "core": { "segment": [ { "id": 7, "...

Converting JSON data to Java object

I want to be able to access properties from a JSON string within my Java action method. The string is available by simply saying myJsonString = object.getJson(). Below is an example of what the string ...

热门标签