Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...Adding Javascript to skinAdding Javascript to skin
Previous
 
Next
New Post
4/6/2006 11:47 AM
 

Can we add javascript to skins in a way that the body onload of every page in the portal automatically binds to

a specific javascript function.

 

Thanks in Advance,

Hameer   

 
New Post
4/6/2006 2:27 PM
 

Try this:

<script>
function YourFunction()
{

         // if there are original onload run it
     if (origOL)
                      eval(origOL)

/***************your code here**************/

 }
// Get the original onload.
 var origOL = document.onLoad

//Set onload to your function
 document.onLoad = YourFunction()
</script>

 

 
New Post
4/6/2006 4:50 PM
 

It is not recommended to just overwrite any potential code that is using the onload event handler with your own, for modules or the core may have onload event handlers of their own.

If you are ok with writing server-side code to add your handler the DNNClientAPI.AddBodyOnloadEventHandler method is preferable.  However, if you just want to write script I suggest adding your function with this code.

if (__dnn_ClientAPIEnabled()) 
   dnn.dom.attachEvent(window, 'onload', yourfunctionname);
else
   window.onload = yourfunctionname

Sam's method should also work (assuming he meant window.onload instead of document.onload and the L is lowercase).


 
New Post
4/17/2006 7:12 AM
 

Firstly, im sorry to be ignorant abt the replies for a long time.

Thanks a lot both of you for ur replies.

Jon, i made a bit of mistake in my post actually i want the event onAfterLoad of body element because i have to traverse all the input controls in the document. So, may be there is a window.onafterload event too.

Now, please tell me how can i go about adding this script to the Skin.

Regards,

Hameer Saleem

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...Adding Javascript to skinAdding Javascript to skin


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out