Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

$4.95 Windows Hosting at Webhost4life.com
  Need Help?  
Professional technical support for DotNetNuke is available from DotNetNuke Corporation.
 


  Ads  
The best choice for your web site host, email hosting, and domain registration.
 


  Sponsors  

Meet Our Sponsors

AspDotNetStoreFront - E-Commerce by Design - The Leading ASP.NET shopping cart platform for developers!
Click here to go to dev.live.com for Windows Live developer resources
SteadyRain
DataSprings - Great Ideas. Always Flowing.
R2integrated - formerly bi4ce
Jango Studios - Skins, Modules and Hosting for DotNetNuke
 


DotNetNuke Forums
 
  Forum  DotNetNuke® Pro...  HTML / Text Mo...  How to Call CSS and Javascript to HTML/TEXT Module
Previous Previous
 
Next Next
New Post 5/11/2008 8:51 AM
User is offline jgurley
38 posts
10th Ranked


Re: How to Call CSS and Javascript to HTML/TEXT Module 

I'd really like to hear the answer to this as well.  I haven't found any way of including my own xxx.js files into the page header.  I looked at the contents of the container and skin files and didn't see any sign of similar stuff.

 
New Post 5/11/2008 3:05 PM
User is offline Rhys
51 posts
10th Ranked


Re: How to Call CSS and Javascript to HTML/TEXT Module 

Hi all,

I know this is almost definitely the 'wrong' answer in the sense that there are better ways of achieving the end result, but there is nothing to stop you putting <script src="myjavascriptfile.js" type="text/javascript"></script> directly into a Text/HTML module. Just switch to source view before you enter the text otherwise the raw HTML will get HTMLEncoded and appear as literal text.

When I want to have some javascript loaded for a page I usually create a custom module to do the work for me. All you need in the modules PageLoad event handler is something like this (code in C#);

         try
         {
            if (!ClientAPI.IsClientScriptBlockRegistered(this.Page, "
myjavascriptfile.js"))
            {
               ClientAPI.RegisterClientScriptBlock(this.Page, "
myjavascriptfile.js", "<script type=\"text/javascript\" src=\"/mypath/myjavascriptfile.js\"></script>");
               ClientAPI.RegisterStartUpScript(this.Page, "", "<script type=\"text/javascript\">
myjavascriptfile_init();</script>");
            }
         }
         catch (Exception exc) //Module failed to load
         {
            Exceptions.ProcessModuleLoadException(this, exc);
         }

This code links in the JavaScript file /mypath/myjavascriptfile.js if it is not already linked and sets the function myjavascriptfile_init() to call once the page has loaded. Once I've created the module I can just add it to whichever pages need the JavaScript. If this isn't the best way to get a module to link in JavaScript I hope someone will correct me.

Hope this is enough to get you all going.

Rhys.


www.rmjcs.com - Mostly SQL Server Stuff
 
New Post 7/2/2008 5:48 PM
User is offline Andre
3 posts
10th Ranked


Re: How to Call CSS and Javascript to HTML/TEXT Module 

Hi Sameer.

Here is the top rows from my working added CSS DNN hml/text mod:

<p>
<link href="http://www.yourdomain.com/Portals/9/portal.css" type="text/css" rel="stylesheet" />
<link href="http://www.yourdomain.com/Portals/9/arrows.css" type="text/css" rel="stylesheet" />
<link href="http://www.yourdomain.com/Portals/9/box.css" type="text/css" rel="stylesheet" /></p>
<p>&#160;</p>
<p>

Portal.css is the standard one, and the others are ones that I have made.

Hope this works for you too.

 
Previous Previous
 
Next Next
  Forum  DotNetNuke® Pro...  HTML / Text Mo...  How to Call CSS and Javascript to HTML/TEXT Module
 


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, 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 DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

 


TMA Resources
TMA Resources is a software company providing eBusiness solutions for the Association market.
www.tmaresources.com
DotNetNuke Hosting Provider UK
UK leading DotNetNuke Hosting provider. Owned and operated by a Microsoft Gold Certified Partner.
www.DNN-Portals.co.uk
Alliance Systems & Programming Inc
Alliance is not just our name... it's how we do business. We partner with our clients, learning their business processes and standards and then applying our expertise to help them improve their workflow and profitability.
www.Alliancesys.com

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP