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...Administration ...Administration ...JavaScript Conflict with File ManagerJavaScript Conflict with File Manager
Previous
 
Next
New Post
9/10/2007 12:28 PM
 

For purely visual effects, I am using some JavaScript in the header div tag to randomly display a background image upon page reload. It works fine, but is conflicting with the JavaScript used on the File Manager page. The error I am receiving is: selTreeNode is null or not an object
dnn.controls.controls

Can anything be done to my JavaScript to correct the conflicts occuring between it and the File Manager JS? I am running version 4.05.01. As always, thanks.

<script type="text/javascript">
<!--
if (document.getElementById) { window.onload = swap };

function swap() {
var numimages=15;
rndimg = new Array("/Portals/0/header-bg/bg-1.jpg", "/Portals/0/FPCU-Developer/header-bg/bg-2.jpg", "/Portals/0/FPCU-Developer/header-bg/bg-3.jpg", "/Portals/0/FPCU-Developer/header-bg/bg-4.jpg", "/Portals/0/FPCU-Developer/header-bg/bg-5.jpg", "/Portals/0/FPCU-Developer/header-bg/bg-6.jpg", "/Portals/0/FPCU-Developer/header-bg/bg-7.jpg", "/Portals/0/FPCU-Developer/header-bg/bg-8.jpg", "/Portals/0/FPCU-Developer/header-bg/bg-9.jpg", "/Portals/0/FPCU-Developer/header-bg/bg-10.jpg", "/Portals/0/FPCU-Developer/header-bg/bg-11.jpg", "/Portals/0/FPCU-Developer/header-bg/bg-12.jpg", "/Portals/0/FPCU-Developer/header-bg/bg-13.jpg", "/Portals/0/FPCU-Developer/header-bg/bg-14.jpg", "/Portals/0/FPCU-Developer/header-bg/bg-15.jpg");
x=(Math.floor(Math.random()*numimages));
randomimage=(rndimg[x]);
document.getElementById("header").style.backgroundImage = "url("+ randomimage +")";
}
//-->
</script>

 
New Post
9/10/2007 2:09 PM
 

Your logic basically is truncating any other module or framework code that wishes to put code in the onload event.  You need to use a more friendly approach for adding your onload handler.  The DNN Framework has this in the DNNClientAPI namespace (can't remember the name, something like AddBodyOnLoad).


 
New Post
9/10/2007 2:55 PM
 
Thanks - it was indeed the onload handler.

The solution for anyone who is interested (compliments of my developer friend JV): 

Delete this line:
if (document.getElementById) { window.onload = swap };

Add this before the close body tag:
<script type="text/javascript">
swap()
</script>

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...JavaScript Conflict with File ManagerJavaScript Conflict with File Manager


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