September 06, 2008
For ColdFusion hosting try HostMySite.com. |
Home /
Groups /
ColdFusion Talk (CF-Talk)
Multiple "onLoads" on <body> tag?
Hi,Bushy 05/12/03 07:34 A > <body onload="KeepAlive()">Matthew Walker 05/12/03 07:44 A Three possible options:Andre Mohamed 05/12/03 07:45 A What you would want to do is build a function in your JavaScript, which bothDave Sueltenfuss 05/12/03 07:38 A <body onload="KeepAlive();formName.fieldName.focus();">Pascal Peters 05/12/03 07:40 A ThankBushy 05/12/03 07:46 A Hmm...Bushy 05/12/03 07:50 A Nevermind...I got it to work.Bushy 05/12/03 07:53 A Due to outlook there is an error in my script. It should say: functionPascal Peters 05/12/03 07:42 A
Author: Bushy
Hi, Currently I have the following body tag: <body onload="KeepAlive()"> I would also like to add the below onload function. How can I add this to the above tag? Can you have multiple onloads? onLoad="formName.fieldName.focus();
Author: Matthew Walker
> <body onload="KeepAlive()"> > > I would also like to add the below onload function. How can I add this to the above tag? Can you have multiple onloads? > > onLoad="formName.fieldName.focus(); Like this: <body onload="KeepAlive();formName.fieldName.focus();"> Actually here's something I sometimes do: <cfset request.bodyOnLoad = ""> <cfset request.bodyOnLoad = listappend(request.bodyOnLoad, "KeepAlive()", ";")> <cfset request.bodyOnLoad = listappend(request.bodyOnLoad, "formName.fieldName.focus()", ";")> <body onload="#request.bodyOnLoad#">
Author: Andre Mohamed
Three possible options: 1) Use a semi-colon between statements e.g. <body onLoad="KeepAlive();formName.fieldName.focus();"> 2) Or use a generic onLoad function which contains calls to other functions e.g. <script language="Javascript"> function myOnLoad() { KeepAlive(); formName.fieldName.focus(); //etc. etc. } </script> Then: <body onLoad="myOnLoad()"> 3) Override the onLoad event for the document e.g. document.onLoad = myOnLoad; And repeat as above. With this option you don't need to place an onLoad event handler in the body tag. Hope that helps. André Hi, Currently I have the following body tag: <body onload="KeepAlive()"> I would also like to add the below onload function. How can I add this to the above tag? Can you have multiple onloads? onLoad="formName.fieldName.focus();
Author: Dave Sueltenfuss
What you would want to do is build a function in your JavaScript, which both calls the KeepAlive() function, an then set the focus to the field you want. You then refer to this new function in the onload statement on the body tag Dave Hi, Currently I have the following body tag: <body onload="KeepAlive()"> I would also like to add the below onload function. How can I add this to the above tag? Can you have multiple onloads? onLoad="formName.fieldName.focus();
Author: Pascal Peters
<body onload="KeepAlive();formName.fieldName.focus();"> OR create an onload function <script language="JavaScript" type="text/javascript"> <!-- Function initPage(){ KeepAlive(); formName.fieldName.focus(); } // --> </script> ... <body onload="initPage();"> Hi, Currently I have the following body tag: <body onload="KeepAlive()"> I would also like to add the below onload function. How can I add this to the above tag? Can you have multiple onloads? onLoad="formName.fieldName.focus();
Author: Bushy
Thanks
Author: Bushy
Hmm... I just tried the below code and the cursor won't appear in my form field? --script language="JavaScript" type="text/javascript"-- <!-- Function initPage(){ KeepAlive(); processFormSubmission.AccountNumber.focus(); } // --> --/script-- <body onload="initPage();"> Could there be a conflict with other JS I'm loading between my <head>...</head> tags?
Author: Bushy
Nevermind...I got it to work. Thanks
Author: Pascal Peters
Due to outlook there is an error in my script. It should say: function initPage(){ <body onload="KeepAlive();formName.fieldName.focus();"> OR create an onload function <script language="JavaScript" type="text/javascript"> <!-- Function initPage(){ KeepAlive(); formName.fieldName.focus(); } // --> </script> ... <body onload="initPage();"> Hi, Currently I have the following body tag: <body onload="KeepAlive()"> I would also like to add the below onload function. How can I add this to the above tag? Can you have multiple onloads? onLoad="formName.fieldName.focus();
|
Mailing Lists
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||