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 not running when inserted into a Text/HTML module (in IE)Javascript not running when inserted into a Text/HTML module (in IE)
New Post
5/16/2013 6:15 AM

I am trying to use a piece of JavaScript inside a Text/HTML module.

Its a countdown clock and it fails to display all the countdown numbers in IE 6,7,8 and 9).
It does work ok in all Non-IE Browsers and IE 10, but not in older versions of IE.
However it does work when used outside DNN environment (on all browsers and all version of IE).

This is the Header bit and the JavaScript code (I've placed it inside Settings >> Advanced Settings):

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="css/countdown.css" rel="stylesheet" type="text/css"  />    

<script type="text/javascript">
var current="&nbsp; &nbsp; LGPS &nbsp; 2014&nbsp; is &nbsp;here!"   
var year=2014;   
var month=04;    
var day=01;     
var hour=00;    
var minute=00; 
var tz=0;       

var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");

function countdown(yr,m,d,hr,min){
    var today=new Date();
    var todayy=today.getYear();
    if (todayy < 1000) {todayy+=1900;}
    var todaym=today.getMonth();
    var todayd=today.getDate();
    var todayh=today.getHours();
    var todaymin=today.getMinutes();
    var todaysec=today.getSeconds();
    var todaystring1=montharray[todaym]+" "+todayd+", "+todayy+" "+todayh+":"+todaymin+":"+todaysec;
    var todaystring=Date.parse(todaystring1)+(tz*1000*60*60);
    var futurestring1=(montharray[m-1]+" "+d+", "+yr+" "+hr+":"+min);
    var futurestring=Date.parse(futurestring1)-(today.getTimezoneOffset()*(1000*60));
    var dd=futurestring-todaystring;
    var dday=Math.floor(dd/(60*60*1000*24)*1);
    var dhour=Math.floor((dd%(60*60*1000*24))/(60*60*1000)*1);
    var dmin=Math.floor(((dd%(60*60*1000*24))%(60*60*1000))/(60*1000)*1);
    var dsec=Math.floor((((dd%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1);
    else {
<body onload="countdown(year,month,day,hour,minute);">

This is the HTML inside the Text/HTML module editor:
<table background="alldials.png" width="710px" height="105px" cellpadding="0" cellspacing="0" border="0">
    <td width="355" cellpadding="0" cellspacing="0" border="0">
        <span class="strapline">
            <a href="http://www.sypensions.org.uk/FutureLGPSNews/tabid/629/language/en-GB/Default.aspx"><img src="clickHere.png" width="185px" border="0"></a>
    <td width="355">
        <table id="table" border="0" cellpadding="0" cellspacing="0">
                <td><div id="count2"></div></td>
            <tr id="spacer1">
                <td align="center"> <div class="numbersD" id="dday"> </div> </td>
                <td align="center"> <div class="numbersH" id="dhour"> </div> </td>
                <td align="center"> <div class="numbersM" id="dmin"> </div> </td>
                <td align="center"> <div class="numbersS" id="dsec"> </div> </td>

 I'm wondering if its to do with the actual doctype on my DotNetNuke page?
Because it does work outside DNN and does work in IE10 and other non-IE browsers in this way above.


New Post
5/16/2013 8:11 AM

I would suggest not to inject Javascript using an HTML module. I recommend the Content Injection Module for DotNetNuke by Will Strohl: http://wnsinj.codeplex.com/

That gives you much mor control over what you want to do.

Best wishes

Michael Tobisch
dnn-Connect.org - The most vibrant community around the DNN-platform
New Post
5/17/2013 2:43 AM
If you are getting problem in running js code from HTML module, then there is still option to add the script to your skin file. But from HTML module it should work.

Sunil Kumar [ DNN Developer, Mindfire Solutions,India ]
New Post
5/17/2013 2:53 AM

please tell me the reason for putting a Javascript to a skin file when you need this script on one page. This is a bit of an overhead. The module I mentioned in my post above does great work for that, and you have the choice where you want the script to be placed during rendering.

And: you can inject any type of content (meta-tags etc.).

Best wishes

Michael Tobisch
dnn-Connect.org - The most vibrant community around the DNN-platform
New Post
5/17/2013 3:09 AM
Most of the times we make one separate skin file for home page and one for all internal pages.
Thats why i suggested to do so thinking that the html module used in the home page. Any way this is a option i suggested. User will use it if they think it will work for them.
And thanks for the module you suggested.

Sunil Kumar [ DNN Developer, Mindfire Solutions,India ]
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Javascript not running when inserted into a Text/HTML module (in IE)Javascript not running when inserted into a Text/HTML module (in IE)

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.

Content Layout

Subscribe to DNN Digest

Subscribe to DNN Digest

DNN Digest is our monthly email newsletter. It highlights news and content from around the DNN ecosystem, such as new modules and themes, messages from leadership, blog posts and notable tweets. Keep your finger on the pulse of the ecosystem by subscribing.  

Copyright 2018 by DNN Corp Terms of Use Privacy
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out