Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-25-2005, 02:25 AM   PM User | #1
Jaffa_Kree2k5
New to the CF scene

 
Join Date: May 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Jaffa_Kree2k5 is an unknown quantity at this point
Question Reload page after no user activity

Hello, I am trying to incorporate a script that will refresh a page after there has been no activty for 1 minute. My page seems to refresh no matter what. Any insight on what's wrong with my code?


<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
if (document.layers) {
window.captureEvent(onMouseMove);
}

window.onMouseMove = reloadPage;
var tID = '';

function reloadPage() {
window.clearTimeout(tID); // reset the timer
tID = setTimeout("window.location=\'index.cfm?
fuseaction=printing.checkjobs\'",100000); // refresh the page in 1
minute after no activity
}

//-->
</SCRIPT>

<body onLoad="reloadPage()">

Last edited by Jaffa_Kree2k5; 05-25-2005 at 01:48 PM..
Jaffa_Kree2k5 is offline   Reply With Quote
Old 05-25-2005, 02:42 AM   PM User | #2
Harry Armadillo
Regular Coder

 
Join Date: Feb 2005
Posts: 400
Thanks: 0
Thanked 0 Times in 0 Posts
Harry Armadillo is on a distinguished road
Don't capitalize onmousemove.

window.onmousemove = reloadPage;
Harry Armadillo is offline   Reply With Quote
Old 05-25-2005, 01:26 PM   PM User | #3
Jaffa_Kree2k5
New to the CF scene

 
Join Date: May 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Jaffa_Kree2k5 is an unknown quantity at this point
Question

I did that and nothing seems to be happening. No page refresh. I will continue to work on it unless someone else has a suggestion or code that works.

I will strip it out of my app and see what it does indepently.

UPDATE:
After stripping out of my app it reloads all the time whether there is activity or not, but within my app it does not refresh at all. Weird...

Thanks in advance for any insight.

Last edited by Jaffa_Kree2k5; 05-25-2005 at 01:47 PM..
Jaffa_Kree2k5 is offline   Reply With Quote
Old 05-25-2005, 10:17 PM   PM User | #4
Harry Armadillo
Regular Coder

 
Join Date: Feb 2005
Posts: 400
Thanks: 0
Thanked 0 Times in 0 Posts
Harry Armadillo is on a distinguished road
I tested your code snippet with onmousemove and it worked just as expected -- keep moving the mouse, no refresh; hold still too long, refresh.

Got a link to your whole page?
Harry Armadillo is offline   Reply With Quote
Old 05-25-2005, 10:32 PM   PM User | #5
Jaffa_Kree2k5
New to the CF scene

 
Join Date: May 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Jaffa_Kree2k5 is an unknown quantity at this point
Question

Well, it works in Firefox, but not in IE6 and that is what everyone uses here. I don't have a link to the specific page since it's an internal application. Also, it exceeds the maximum lines for posting.

Any ideas why it won't work in IE6?
Jaffa_Kree2k5 is offline   Reply With Quote
Old 05-25-2005, 10:40 PM   PM User | #6
Harry Armadillo
Regular Coder

 
Join Date: Feb 2005
Posts: 400
Thanks: 0
Thanked 0 Times in 0 Posts
Harry Armadillo is on a distinguished road
I ran it on IE5.5, I can't imagine why IE6 would be having problems...perhaps try with it document.onmousemove.

Zipping the page is possible - either attaching the zip or posting a link to where you host it.
Harry Armadillo is offline   Reply With Quote
Old 05-25-2005, 10:51 PM   PM User | #7
Jaffa_Kree2k5
New to the CF scene

 
Join Date: May 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Jaffa_Kree2k5 is an unknown quantity at this point
Unhappy

Actually, I think it may fit. I tried the script using document.onmousemove in a separate file with just plain text and it worked. When I use it for my page, it does nothing.
------------------------------------------------------------------
<a name="top"></a>

<cfsavecontent variable="sort_script">
<script type="text/javascript" src="scripts/sorttable.js"></script>
<script type="text/javascript" src="scripts/reload.js"></script>
</cfsavecontent>

<cfhtmlhead text="#sort_script#"/>


<body onLoad="reloadPage()">

<cfif attributes.qryGetOrders.recordcount>
<cfquery name="ordsearch" dbtype="query">
SELECT * FROM attributes.qryGetOrders ORDER BY Comp_Order_Ship_Date, EK_ClientName, EK_ProductName, EK_OrderID
</cfquery>
<cfelse>
<cfset ordsearch = attributes.qryGetOrders/>
</cfif>


<CFOUTPUT>

<cfsavecontent variable="table">

#app.GenTable#
<TR BGCOLOR="#app.S_Color.TableHeader#">
<th>Complete</th>
<th>Check Out</th>
<th>Ship Date</th>
<th>Order ID</th>
<th>Product</th>
<th>Plan Sponsor</th>
<th>Order Status</th>
<th>Order Date</th>
<th>Total Qty</th>

</tr>

<!--- Sets up the first line of the tab-delimited file --->

<cfset output="Ship Date" & chr(9) & "Order ID" & chr(9) & "Product" & chr(9) & "Plan Sponsor" & chr(9) & "Order Status" & chr(9) & "Order Date" & chr(9) & "Total Qty" & chr(10)>

<CFLOOP QUERY="ordsearch">
<cfset show = 1>

<cfif len(EK_FullFill_Cmmts) and AcctMgrReleased eq 0>
<cfset show = 0>
</cfif>

<cfif ShippingInstructionsExist and AcctMgrReleased eq 0>
<cfset show = 0>
</cfif>

<cfif show eq 1>
<!--- Process the Plan name filter if any --->
<!--- <cfset orddisp = System_Abbr & "-" & EK_OrderID>
<cfset shipdate = DateFormat(comp_order_ship_date, "mm/dd/yyyy")>
<cfset orderdate = DateFormat(EK_OrderTS, "mm/dd/yyyy")> --->
<!--- Process the order id filter if any --->

<TR BGCOLOR="#app.S_Color.Table#" ALIGN="CENTER">
<td>
<cfif Status_Code eq 3 or Status_Code eq 6>
<cfif CheckedOut EQ 0>
<cfif Status_Code NEQ 6>
<input type="CheckBox" name="CheckInOrderID" value="#OrderID#">
<cfelse>
<img src="../images/icons/Rarrow.gif" alt="&nbsp;">
</cfif>
<cfelse>
<img src="../images/icons/Rarrow.gif" alt="&nbsp;">
</cfif>
<cfelse>
&nbsp;
</cfif>
</td>
<td>
<cfif Status_Code eq 3 or Status_Code eq 6>
<cfif CheckedOut EQ 0>
<a href="index.cfm?fuseaction=printing.checkoutjob&CheckOutOrder=#OrderID#">
<img src="../images/icons/view.gif" alt="View"></a>
<cfelse>

<font color="red">#UserName#</font>
</cfif>
<cfelse>
&nbsp;
</cfif>
</td>
<TD>#shipdate#</TD>
<td><a href="index.cfm?fuseaction=printing.ordrpt&orderid=#OrderID#">#orddisp#
<cfif len(ordsuffix)>_#ordsuffix#</cfif></a>

<cfif MessageExists>
<A HREF="javascriptopUp('../dsp/dsp_viewnotes.cfm?orderid=#OrderID#&maindsn=#request.maindsn#')">
<img src="../images/icons/help3.gif" alt="&nbsp;" border=0></a>
</cfif></td>
<td>#prodname#</td>
<td>#left(compname, 10)#</td>
<TD><cfif Status_Code_Desc EQ "On Hold">
<font color="red">#Status_Code_Desc#</font>
<cfelse>
#Status_Code_Desc#
</cfif>
</TD>
<TD>#orderdate#</TD>
<td>#TotQty#</td>

</tr>

<!--- Prepare the line for the tab delimited file --->

<cfset output = output & shipdate & chr(9) & orddisp& chr(9) & Plan_Sponsor & chr(9) & left(compname, 10)& chr(9) & Status_Code_Desc& chr(9) & orderdate & chr(9) & TotQty & chr(9) >

</cfif>

</cfloop>

</cfsavecontent>


#request.orderQueueSearchForm#

<cfif ordsearch.RecordCount GT 5>
<table width="98%" border="0">
<tr>
<td width="90%" colspan="3">&nbsp;</td>
<td width="8%" align="center" bgcolor="##CCCCCC"><a href="##bottom"><font face="Arial" size="2"><strong>Bottom of Page</strong></font></a></td>
</tr>
<tr>

<td align="right">
<form action="index.cfm?fuseaction=printing.quickcomplete" method="post" >
<input type="Submit" name="QuickC" value="Quick Complete">
</form>
</td>
<td align="right">

<form action="index.cfm?fuseaction=printing.exportcsv" method="post" target="_blank">
<input type="hidden" name="output" value="#output#">
<input type="Submit" name="ExportXL" value="Export to Excel">
</form>

</td>
<td align="center">
<form action="index.cfm?fuseaction=#myfusebox.originalcircuit#.main" method="post">
<input type="Submit" name="Cancel" value="Cancel/Return to #main.section# Menu">
</form>
</td>
<td>&nbsp;</td>
</tr>
</table>
</cfif>
<br>
<br>
<P><B>The following orders are available to print:</B></P>


<!--- Table modified to have Sortable Columns --->

<FORM>

#table#

</TABLE>
<br>
<b>Initials:</b> <input type="text" Name="Initial" Size="20" Maxlength="50">
<br>
<a name="bottom"></a>
<br><br>

<table width="98%" border="0">
<tr>
<td width="90%" colspan="4">&nbsp;</td>
<td width="8%" align="center" bgcolor="##CCCCCC">
<a href="##top"><font face="Arial" size="2"><strong>Top of Page</strong></font></a>
</td>
</tr>
<tr>
<td align="right"><input type="Reset" name="ResetForm" value="Reset Choice"></td>
</form>
<td align="right">
<form action="index.cfm?fuseaction=printing.quickcomplete" method="post" ><br>
<input type="Submit" name="QuickC" value="Quick Complete">
</form>
</td>
<td align="right">
<form action="index.cfm?fuseaction=printing.exportcsv" method="post" target="_blank"><br>

<input type="hidden" name="output" value="#output#">
<input type="Submit" name="ExportXL" value="Export to Excel">
</form>
</td>
<td align="center">
<form action="index.cfm?fuseaction=#myfusebox.originalcircuit#.main" method="post"><br>

<input type="Submit" name="Cancel" value="Cancel/Return to #main.section# Menu">
</form>
</td>
<td>&nbsp;</td>
</tr>
</table>

</cfoutput>

</body>
Jaffa_Kree2k5 is offline   Reply With Quote
Old 05-25-2005, 11:34 PM   PM User | #8
Harry Armadillo
Regular Coder

 
Join Date: Feb 2005
Posts: 400
Thanks: 0
Thanked 0 Times in 0 Posts
Harry Armadillo is on a distinguished road
Yeah, well, that wasn't too useful. A fellow would have to see the page as the browswer sees it, not the assorted coldfusion junk. I got no way of knowing where/how the script could be sabotaged.
Harry Armadillo is offline   Reply With Quote
Old 05-26-2005, 02:31 PM   PM User | #9
Mr J
Senior Coder

 
Join Date: Aug 2002
Location: UK
Posts: 2,789
Thanks: 2
Thanked 14 Times in 14 Posts
Mr J is on a distinguished road
Try it this way

PHP Code:
<HTML>
<
HEAD>
<
TITLE>Document Title</TITLE>
<
script type="text/javascript">
<!--

if (
document.layers) {
window.captureEvent(onMouseMove);
}

document.onmousemove oreset

var tID '';

function 
oreset(){
clearTimeout(tID)
count=0
reloadPage
()
}

function 
reloadPage(){
count++
if(
count==60){ // 1 minite
window.location=index.cfm?fuseaction=printing.checkjobs
}
tID setTimeout("reloadPage()",1000);
}

//-->
</script>
</HEAD>
<BODY onload="oreset()">



</BODY>
</HTML> 
__________________
The silent one.

The most dangerous thing in the world is an idea.
The most dangerous person in the world is the one with an idea.
Mr J is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:32 PM.


Advertisement
Log in to turn off these ads.