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  |  

ExactTarget - What's Your Score
  Need Help?  
Professional technical support for DotNetNuke is available from DotNetNuke Corporation.
 


  Ads  
Iron Speed Designer is a software development tool for building database, reporting, and forms applications for .NET without hand-coding.
 


  Sponsors  

Meet Our Sponsors

CrystalTech Web Hosting™
Webhost4life, specialists in DNN hosting
Mad Development is a full service interactive agency focusing on the merge of design, technology, e-commerce, and affiliate marketing by providing total website solutions.
MadCap Software, Inc.
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
 


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
37 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.

 


The Standard in Senior Housing Information
SNAPforSeniors provides consumers with free online resources to assist them with their search for senior housing
www.snapforseniors.com
DotNetNuke Web Hosting w/ ASP.NET 3.5
Unlimited email boxes, Unlimited databases, Unlimited domains. Plans start at $4.97
www.MyWinHosting.com
SteadyRain
Founded in 1999, SteadyRain has extensive experience delivering Internet technology strategies and solutions for a diverse client base, ranging from Fortune 500 firms to successful start-ups.
www.steadyrain.com

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