HTML 延迟加载显示

html-css07

HTML 延迟加载显示,第1张

HTML 延迟加载显示

<div id="vodid1">第一个按钮直接显示</div>

<input type="submit" value=""  style="width: 1pxheight: 1pxbackground-color: transparentborder: 0FILTER: alpha(opacity=0)" />

间隔线来咯---------------------

<div id="vodid2">第二个按钮/图片,延迟加载显示</div>//广告位置,想延迟加载

    <script type="text/javascript">

        var html="<img src='http://static.cnblogs.com/images/logo_small.gif'/>"

        setTimeout("document.getElementById('vodid2').innerHTML=html",5000)//延时5秒

    </script>

1.[self performSelector:@selector(函数名) withObject:nil afterDelay:5.0f]

条件:在uiviewController的主线程中

2.[NSTimerscheduledTimerWithTimeInterval:5.0f target:self selector:@selector(函数名) userInfo:nil repeats:NO]

在具体函数中,执行代码,执行完毕以后调用NSTimer invalidate方法来销毁timer

3.[NSThread sleepForTimeInterval:5.0f]

[要延迟执行的方法]

条件:主线程或者子线程都可

使用js的setTimeout()定时器。

定义和用法

setTimeout() 方法用于在指定的毫秒数后调用函数或计算表达式。

setTimeout() 只执行 code 一次。

语法:

setTimeout(code,millisec)