我试图构建功能,这将改变" onmouseover"没有页面刷新的事件,但没有工作。
<script>
i = 0;
function foto_start() {
x = ["image2", "image3", "image4"];
y = document.getElementById("1").src;
//loop replace in string "image1" on "image2", "image3" ...
while(1) {
z = y.replace("image1", x[i]);
setTimeout(new_image(), 1000);
//if the last element in array, set i = 0 else increase
if(x[i] == "image4")
i = 0;
else
i++;
}
}
function new_image() {
document.getElementById("1").src = z;
}
function foto_stop() {
document.getElementById("1").src = "http://example.com/image1.jpg";
}
</script>
&#13;
// element HTML to modify
<img id="1" onmouseover="foto_start()" onmouseout="foto_stop()" src="http://example.com/image1.jpg" />
&#13;
答案 0 :(得分:0)
不需要那么复杂的东西,你可以在credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
GoogleClientSecrets.Load(stream).Secrets,
Scopes,
"user",
CancellationToken.None,
new NullDataStore()).Result;
方法中添加一个参数:
foto_start()