時間経過によるページ遷移

サンプル

[フレーム]

[[html]]
<styletype="text/css">
@import url(http://scp-jp.wdfiles.com/local--files/japanese-syntax/scp-WikidotCss.css);
</style><scripttype="text/javascript"src="http://shitake-crude-production.wikidot.com/time-move/code/1"></script><scripttype="text/javascript">
function previewTime(argObj){
 var target = document.getElementById("times");
 target.innerHTML = addDigit(TimeRugMove.convert(argObj.rem,"sec",true),2) + ":" + addDigit(TimeRugMove.convert(argObj.rem,"msec",true),3);
 function addDigit(n,dn){
 n = String(n);
 while(n.length <dn){
 n = "0" + n;
 }
 returnn;
 }
}
 
TimeRugMove.callback = previewTime;
TimeRugMove.time = 20;//20秒後に画面移動
TimeRugMove.url = "http://ja.scp-wiki.net/";//SCP財団に移動する
 
</script>
指定時間経過でSCP財団に遷移<br/><buttononclick="TimeRugMove.run();">start</button><br/><buttononclick="TimeRugMove.pause();">pause</button><br/><buttononclick="TimeRugMove.clear();">stop</button><divid="times"></div>
[[/html]]

解説

<script type="text/javascript" src="http://shitake-crude-production.wikidot.com/time-move/code/1"></script>

をコードの上部にインポートすると

TimeRugMove

というオブジェクトが使えるようになります。

このオブジェクトに対し

TimeRugMove.time = 50;

で画面を遷移させたい経過時間

TimeRugMove.url = "http://ja.scp-wiki.net/";

で、遷移したい画面のURLを設定し、

TimeRugMove.run();

によって時間の計測および設定した時間以上が経過した場合の画面遷移を設定します。

なお、

TimeRugMove.callback

というプロパティに関数を渡す事によって時間計測中に作動させる関数を設定する事ができる。このプロパティに渡した関数内では現在の経過時間、及び画面遷移までの残り時間を取得する事ができます。

TimeRugMoveの仕様

下記ページをご覧ください。

時限式移動

page revision: 7, last edited: 04 Jun 2018 14:13
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License
Click here to edit contents of this page.
Click here to toggle editing of individual sections of the page (if possible). Watch headings for an "edit" link when available.
Append content without editing the whole page source.
Check out how this page has evolved in the past.
If you want to discuss contents of this page - this is the easiest way to do it.
View and manage file attachments for this page.
A few useful tools to manage this Site.
Change the name (also URL address, possibly the category) of the page.
View wiki source for this page without editing.
View/set parent page (used for creating breadcrumbs and structured layout).
Notify administrators if there is objectionable content in this page.
Something does not work as expected? Find out what you can do.
General Wikidot.com documentation and help section.
Wikidot.com Terms of Service - what you can, what you should not etc.
Wikidot.com Privacy Policy.

AltStyle によって変換されたページ (->オリジナル) /