|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
Multiple "onLoads" on <body> tag?
Author: Bushy
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:23818#119673
Nevermind...I got it to work.
Thanks
----- Excess quoted text cut - see Original Post for more -----
Author: Bushy
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:23818#119672
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?
----- Excess quoted text cut - see Original Post for more -----
Author: Bushy
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:23818#119671
Thanks
----- Excess quoted text cut - see Original Post for more -----
Author: Andre Mohamed
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:23818#119670
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: Matthew Walker
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:23818#119669
> <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: Pascal Peters
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:23818#119668
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();
Author: Pascal Peters
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:23818#119667
<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: Dave Sueltenfuss
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:23818#119666
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: Bushy
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:23818#119664
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();
|
May 24, 2012
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||