0
<chart caption='ABC Bank Branches' subCaption='(In 
  Asian Countries)' yaxislabel='Branches' xaxislabel='Country'>
 <set label='Hong Kong' value='235' link="JavaScript:myJS('Hong Kong,235');"/> 
 <set label='Japan' value='123' link="JavaScript:myJS('Japan, 123');"/>
 <set label='Singapore' value='129' link="JavaScript:myJS('Singapore, 129');"/> 
 <set label='Malaysia' value='121' link="JavaScript:myJS('Malaysia, 121');"/> 
 <set label='Taiwan' value='110' link="JavaScript:myJS('Taiwan, 110');"/> 
 <set label='China' value='90' link="JavaScript:myJS('China, 90');"/> 
 <set label='S. Korea' value='86' link="JavaScript:myJS('S.Korea, 86');"/> 
</chart>

在 xml 中,我们在 javascript 中为 XML 文件指定链接,如下所示:link="JavaScript:myJS('Hong Kong,235');"

如何在 javascript 中为 json 数据文件指定链接????

4

1 回答 1

1

JSON 没有特定的本地方式来表示链接。

只需使用一个字符串。

{
    "caption": "ABC Bank Branches",
    "yaxislabel": "Branches",
    "set": [
        {
            "link": "JavaScript:myJS('Hong Kong,235');",
            "value": "235",
            "label": "Hong Kong"
        },
        {
            "link": "JavaScript:myJS('Japan, 123');",
            "value": "123",
            "label": "Japan"
        },
        {
            "link": "JavaScript:myJS('Singapore, 129');",
            "value": "129",
            "label": "Singapore"
        },
        {
            "link": "JavaScript:myJS('Malaysia, 121');",
            "value": "121",
            "label": "Malaysia"
        },
        {
            "link": "JavaScript:myJS('Taiwan, 110');",
            "value": "110",
            "label": "Taiwan"
        },
        {
            "link": "JavaScript:myJS('China, 90');",
            "value": "90",
            "label": "China"
        },
        {
            "link": "JavaScript:myJS('S.Korea, 86');",
            "value": "86",
            "label": "S. Korea"
        }
    ],
    "xaxislabel": "Country",
    "subCaption": "(In    Asian Countries)"
}
于 2012-07-02T12:01:00.487 回答