help for creating web part for refreshing page
I'm fairly new to Sharepoint 2007 , I use a content editor webpart for refreshin page in sharepoint portal.
i use following code in Source Editor of CEWP:
<sc开发者_高级运维ript type="text/javascript" language="javascript">
var reloadTimer = null;
var sURL = unescape(window.location.pathname);
function setReloadTime(secs)
{
if (arguments.length == 1)
{
if (reloadTimer) clearTimeout(reloadTimer);
reloadTimer = setTimeout("setReloadTime()", Math.ceil(parseFloat(secs)*1000));
}
else
{
reloadTimer = null;
location.reload(true);
window.location.replace( sURL );
}
}
setReloadTime(30);
</script>
this code work fine, but i like to use this content editor web part in each page i like. and i like to can set reload time without editing Source Editor of content editor web part. Could any body help me.
Any help appreciated
Just use a content editor web part, with the following code in source view:
10000 is 10 seconds -- change it to whatever you need
<script type="text/javascript">
//<![CDATA[
setTimeout('window.location.reload();', 10000);
// ]]>
</script>
精彩评论