我试图在javascript中访问json对象中的一个字段,其中包含键'*'.jsonstring看起来像这样:
{"parse":
{"text":
{"*":"text i want to access"}
}
}
Run Code Online (Sandbox Code Playgroud)
试图访问myObject.parse.text.*不起作用,myObject.parse.text [0]也不起作用.我现在已经搜索了一个小时,但没有发现星号具有特殊含义的暗示.如果我只是遍历完整的树并进行字符串比较a'if(key =="*")'我可以得到我想要检索的文本,但我想直接访问这个字段.有没有办法进入该领域?
我已经通过maven将twitter4j集成到我的项目中,使用twitter4j主页上显示的depndencies/repositories:
<dependency>
<groupId>org.twitter4j</groupId>
<artifactId>twitter4j-core</artifactId>
<version>[2.2,)</version>
</dependency>
..
<repository>
<id>twitter4j.org</id>
<name>twitter4j.org Repository</name>
<url>http://twitter4j.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
Run Code Online (Sandbox Code Playgroud)
不幸的是,并非所有来自twitter4j核心项目的资源都可以在我的项目中使用.例如,接口"StatusListener"不是.也许有人能给我一个提示有什么不对吗?
在我的代码中,我有一个id为'SIAinfoBox'的div,它将加载不同的细节,具体取决于鼠标当前所处的div.我将以下两个监听器附加到每个相关的div:
$(annoDiv).mouseover(function(event){
event.stopPropagation;
$('#SIAinfoBox').empty();
$('#SIAinfoBox').append(details);
$('#SIAinfoBox').css('visibility','visible');
});
$(annoDiv).mouseleave(function(event){
event.stopPropagation;
$('#SIAinfoBox').empty();
$('#SIAinfoBox').css('visibility','hidden');
});
Run Code Online (Sandbox Code Playgroud)
这些div没有背景颜色设置,但有1px纯黑色边框.在Firefox中,一切运行良好.但是在Internet Explorer中,仅当鼠标位于div的边界上时才会填充SIAinfoBox.在div中移动它似乎会触发mouseleave事件,并删除内容并隐藏div.如果我设置背景颜色,它的工作方式与预期的一样,但没有背景颜色(或透明),它不起作用.我也尝试使用mouseenter而不是mouseover,但结果相同.为什么InternetExplorer表现得像那样,或者我该怎么做才能实现我目前在FF for IE中获得的结果呢?