我使用这个javascript框架http://lab.hakim.se/reveal-js/#/创建了一个演示文稿,当出现某个幻灯片时,我想执行函数stats(),它每隔5秒显示一次来自API的数据,但是仅当此幻灯片出现时
function stats(){
$.ajax({
type: "GET",
url: url_survey,
dataType: "json",
success :
function (data) {
//some code to display data
},
error:
//some code
});
}
Run Code Online (Sandbox Code Playgroud)
在HTML文件中我有这个:
<section>
<div id="stats">
</div>
</section>
Run Code Online (Sandbox Code Playgroud)
我该怎么做?我编写了这段代码,但它始终有效,不仅在幻灯片出现时
function check(){
if($("#stats").is(":visible"))
stats();
}
check();
setInterval(function(){check()}, 2000);
Run Code Online (Sandbox Code Playgroud) 我有这个功能:
function fun_voting_started(){
var now = new Date();
var now_date = now.getDate();
var now_month = now.getMonth(); now_month++;
var now_year = now.getFullYear();
var now_hours = now.getHours();
var now_min = now.getMinutes();
var now_sec = now.getSeconds();
var voting_started = now_year + "-" + now_month + "-" + now_date + " " + now_hours + ":" + now_min + ":" + now_sec;
return voting_started;
}
Run Code Online (Sandbox Code Playgroud)
此功能从计算机加载日期,但有时用户使用的日期不是当前日期。如何从互联网获取当前日期?
在这里:http : //jsfiddle.net/ghvNn/261/我创建了两星级。来自此网页http://rog.ie/blog/css-star-rater。但是此代码仅适用于5星,但我想将其设置为(3,5,7,10)星。我该怎么做?
<span class="star-rating">
<input type="radio" name="rating" value="1"><i></i>
<input type="radio" name="rating" value="2"><i></i>
<input type="radio" name="rating" value="3"><i></i>
<input type="radio" name="rating" value="4"><i></i>
<input type="radio" name="rating" value="5"><i></i>
</span>
<br><br>
<span class="star-rating">
<input type="radio" name="rating" value="1"><i></i>
<input type="radio" name="rating" value="2"><i></i>
<input type="radio" name="rating" value="3"><i></i>
</span>
Run Code Online (Sandbox Code Playgroud) 我有change一些功能,可以将一些字符替换为数字.这里是:
change [] = []
change (x:xs) | x == 'A' = '9':'9':change xs
| x == 'B' = '9':'8':change xs
| otherwise = change xs
Run Code Online (Sandbox Code Playgroud)
输出是:
Main> change "aAB11s"
"9998"
Run Code Online (Sandbox Code Playgroud)
但我需要这个:
Main> change "aAB11s"
"a999811s"
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?
我有一个字符串"AB0123456789",我想要的输出是:"AB01 2345 6789"...我想在每四个字符后添加一个空格.我怎样才能做到这一点?
Main> addSpace "AB0123456789"
"AB01 2345 6789"
Run Code Online (Sandbox Code Playgroud) 看看这个截图:http://imagizer.imageshack.us/a/img844/4241/at9t.jpg ......这是来自Powerpoint.在那里你可以改变你的子弹.但是我创建了一个Powerpoint加载项,我需要在c#中更改项目符号.
这是如何添加第一个子弹(黑色小圆圈),但我想添加其他(白色大圆圈或其他).我怎样才能做到这一点?
char myCharacter = (char)9675; // white circle unicode
textRange.Paragraphs(i).ParagraphFormat.Bullet.Character = myCharacter;
textRange.Paragraphs(i).ParagraphFormat.Bullet.Type = PpBulletType.ppBulletUnnumbered;
Run Code Online (Sandbox Code Playgroud)
这是微软的网页,但我没有看到对我有用的东西. http://msdn.microsoft.com/en-us/library/microsoft.office.interop.powerpoint.ppbullettype(v=office.14).aspx