我正在尝试使用qtip2.我的问题是我只想在用户点击href
内部指定的html 时显示工具提示.所以我试试这个:
function help(){
var link = document.getElementById('helps');
if(link.innerHTML=="Open"){
$('#helps').qtip({
content: {
text: 'I get shown on click'
},
show: {
event: 'click'
}
});
link.innerHTML = "Close";
}else{
link.innerHTML="Open";
}
}
<a href="javascript:help()" id="helps">Open</a>
Run Code Online (Sandbox Code Playgroud)
我的问题是,当我点击时,文字变为Close
但工具提示不显示.当我再次单击文本时Open
,我会看到工具提示.我能做什么?
我正在使用restfb以这种方式获取Facebook页面每个帖子的一些帖子和每条评论:
FacebookClient facebookClient = new DefaultFacebookClient(MY_ACCESS_TOKEN);
Connection<Post> pagePosts = facebookClient.fetchConnection("iPhone.page/feed", Post.class);
for (List<Post> posts : pagePosts)
for (Post post : posts){
for(Comment comment: post.getComments().getData()){
//get number of likes of comment
}
String message = post.getMessage();
String id = post.getId();
long timestamp = post.getCreatedTime().getTime()/1000;
//store info
}
Run Code Online (Sandbox Code Playgroud)
当它取一个像后我的问题,新生儿此.
它有140条评论,但该toString()
方法给了我:
Post[actions=[...] application=null attribution=null caption=techblr.com comments=Comments[count=157 data=[]] createdTime=Wed Feb 27 14:41:58 CET 2013 ....]
Run Code Online (Sandbox Code Playgroud)
评论的json部分是:
comments=Comments[count=157 data=[]]
count=157
Run Code Online (Sandbox Code Playgroud)
但是,如果你现在继续这个帖子,那就说145 ......而且没有data
!
那可能是什么问题?为什么它给我不同的真实数据呢?
我是离子的新手(在angularjs中稍微少一些).
我正试图在两个视图之间进行简单的切换:
HTML
<body ng-app="starter" animation="slide-left-right-ios7">
<!--
The nav bar that will be updated as we navigate between views.
-->
<ion-nav-bar class="bar-stable nav-title-slide-ios7">
<ion-nav-back-button class="button-icon icon ion-ios7-arrow-back">
Back
</ion-nav-back-button>
</ion-nav-bar>
<ion-nav-view name="intro"></ion-nav-view>
<ion-nav-view name="login"></ion-nav-view>
<ion-nav-view name="home"></ion-nav-view>
<ion-nav-view name="pizze"></ion-nav-view>
<ion-nav-view name="sponsor"></ion-nav-view>
<ion-nav-view name="scontrino"></ion-nav-view>
</body>
Run Code Online (Sandbox Code Playgroud)
APP.js
.config(function($stateProvider, $urlRouterProvider) {
// Ionic uses AngularUI Router which uses the concept of states
// Learn more here: https://github.com/angular-ui/ui-router
// Set up the various states which the app can be in.
// Each state's controller can …
Run Code Online (Sandbox Code Playgroud) 我有一个NSMutableArray初始化10个元素.我试图获得一个元素运行异常时出现的问题..
我以这种方式创建数组:
NSMutableArray *selected = [[NSMutableArray alloc] init];
[selected setValue:[NSString stringWithFormat:@"casa_selected.png"]forKey:[NSString stringWithFormat:@"%d",1]];
[selected setValue:[NSString stringWithFormat:@"chiave_selected.png"]forKey:[NSString stringWithFormat:@"%d",2]];
[selected setValue:[NSString stringWithFormat:@"gatto_selected.png"]forKey:[NSString stringWithFormat:@"%d",3]];
[selected setValue:[NSString stringWithFormat:@"giacca_selected.png"]forKey:[NSString stringWithFormat:@"%d",4]];
[selected setValue:[NSString stringWithFormat:@"nonno_selected.png"]forKey:[NSString stringWithFormat:@"%d",5]];
[selected setValue:[NSString stringWithFormat:@"lumaca_selected.png"]forKey:[NSString stringWithFormat:@"%d",6]];
[selected setValue:[NSString stringWithFormat:@"cane_selected.png"]forKey:[NSString stringWithFormat:@"%d",7]];
[selected setValue:[NSString stringWithFormat:@"occhiali_selected.png"]forKey:[NSString stringWithFormat:@"%d",8]];
[selected setValue:[NSString stringWithFormat:@"portafogli_selected.png"]forKey:[NSString stringWithFormat:@"%d",9]];
[selected setValue:[NSString stringWithFormat:@"telecomando_selected.png"]forKey:[NSString stringWithFormat:@"%d",10]];
Run Code Online (Sandbox Code Playgroud)
当我尝试获取元素时:
[selected valueForKey:[NSString stringWithFormat:@"%d",2]]
Run Code Online (Sandbox Code Playgroud)
它运行此异常:
2011-11-05 10:04:37.426 TrovaChiavi[22307:11f03] -[__NSArrayI isEqualToString:]:
unrecognized selector sent to instance 0x78317b0
2011-11-05 10:04:37.494 TrovaChiavi[22307:11f03] *** Terminating app due to uncaught
exception 'NSInvalidArgumentException', reason: '-[__NSArrayI isEqualToString:]:
unrecognized selector …
Run Code Online (Sandbox Code Playgroud) 我是这样的输入类型图像:
<input type="image" name="formimage2" width="170" height="37" src="images/tasto-registrati.png" onclick="sub()">
Run Code Online (Sandbox Code Playgroud)
这是sub():
function sub(){
var mail = document.getElementsByName('mail')[0];
var name = document.getElementsByName('name')[0];
if(mail.value!=""){
bool = true;
}else{
mail.value="Campo obbligatorio";
mail.style.backgroundColor="red";
bool=false;
}
if(name.value!=""){
bool = true;
}else{
name.value="Campo obbligatorio";
name.style.backgroundColor="red";
bool=false;
}
if(bool){
document.form[0].submit();
}
Run Code Online (Sandbox Code Playgroud)
但每次都提交表格!我怎么能告诉表格只提交那种情况?我尝试:
if(bool){
...
}else{
return false
}
Run Code Online (Sandbox Code Playgroud)
但没什么!你能帮助我吗??
我试图安装一个库,但当make文件尝试尝试Developer
文件夹时,它会显示消息
Too many levels of symbolic links.
Run Code Online (Sandbox Code Playgroud)
所以我尝试:
Go home folder (cd /)
Run Code Online (Sandbox Code Playgroud)
那我试试:
bash-3.2# cd Developer
Run Code Online (Sandbox Code Playgroud)
这是输出:
bash: cd: Developer: Too many levels of symbolic links
Run Code Online (Sandbox Code Playgroud)
可能是什么问题呢?你能帮助我吗?
ls -l
Run Code Online (Sandbox Code Playgroud)
我说
lrwxr-xr-x 1 root wheel 10 14 Mar 09:13 Developer -> /Developer
Run Code Online (Sandbox Code Playgroud) 我必须创建带有箭头的经典组合框,以增加框内的值.我想实现这样的事情:
什么是Java Swing等效的这个组件?
我正在尝试重现像osx lion的客户端这样的邮件客户端.所以我要做的事情如下:
我不知道布局的最佳解决方案是什么呢...有人可以给我一些建议吗?谢谢!!!
我正在开发一个自定义DialogPreference.
当用户在对话框外单击时,它会被取消,我需要避免这种情况.
我知道Dialog有setCanceledOnTouchOutside(boolean cancel)
我需要的方法,但DialogPreference没有.
在onBindDialogView
我尝试:
getDialog().setCanceledOnTouchOutside(true);
Run Code Online (Sandbox Code Playgroud)
但是getDialog()
回归null
.
我能怎么做?有人能帮我吗?
这是我的班级:
public class UpdatePreference extends DialogPreference implements View.OnClickListener{
public UpdatePreference(Context context, AttributeSet attrs) {
super(context, attrs);
setPersistent(false);
setDialogLayoutResource(R.layout.update_dialog_layout);
setPositiveButtonText("");
setNegativeButtonText("");
}
@Override
protected void onBindDialogView(View view) {
super.onBindDialogView(view);
//init my components
}
@Override
protected void onDialogClosed(boolean positiveResult) {
super.onDialogClosed(positiveResult);
}
}
Run Code Online (Sandbox Code Playgroud) 我试图用这种方式使用手风琴和html内容:
<accordion>
<accordion-group ng-repeat="item in items">
<accordion-heading>
<a class="btn btn-primary btn-block btn-elenco">
<img postsrc="img/flag/flag_{{item.index}}.jpg">
</a>
</accordion-heading>
<p ng-bind-html="item.content"></p>
</accordion-group>
</accordion>
Run Code Online (Sandbox Code Playgroud)
和
var items = [];
for(var i=0;i<10;i++){
var content = "<div>TEST</div>";
items.push({index:i,content:content});
}
$scope.items = items;
var app = angular.module('MyApp',['ngSanitize','ui.bootstrap']);
Run Code Online (Sandbox Code Playgroud)
手风琴有效,但html不会渲染成p标签.
可能是什么问题呢?
编辑
如果我尝试类似的东西:
<div ng-bind-html="to_trusted(item.content)"></div>
Run Code Online (Sandbox Code Playgroud)
并为控制器添加功能:
$scope.to_trusted = function(html_code)
{
console.log(html_code);
return $sce.trustAsHtml(html_code);
}
Run Code Online (Sandbox Code Playgroud)
没有什么变化,在控制台我得到许多"未定义"!