By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,137 Members | 2,282 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,137 IT Pros & Developers. It's quick & easy.

Script output not appearing.

P: 71
I have a script that shows the time and date. It's been working on my site for quite a while now. Suddenly it stops showing up, after getting my drop down menu to work.

If I put text between the <div id="datetime"></div> tags, the text shows up, but the javascript output being sent to those some divs doesn't seem to want to work. It should be showing up in the middle of the content pane, just below the first table box. (set by .css)

Here's the script:
Expand|Select|Wrap|Line Numbers
  1. //Original:  Xavier R. (xav@lougaou.com)
  2. //Modified:  Benjamin Wright, Editor
  3. //Web Site:  http://www.lougaou.com/
  4.  
  5. //This script and many more are available free online at The JavaScript Source!!
  6. //http://javascript.internet.com
  7.  
  8. var days = new Array("Sun, ","Mon, ","Tue, ","Wed, ","Thu, ","Fri, ","Sat, "); 
  9. var months = new Array("Jan ","Feb ","Mar ","Apr ","May ","Jun ", 
  10.                        "Jul ","Aug ","Sep ","Oct ","Nov ","Dec " ); 
  11.  
  12. function dt( ) 
  13.     // if browser doesn't support getElementById, 
  14.     // then it won't support CSS...so forget it 
  15.     if ( document.getElementById == null ) return; 
  16.     var dt = new Date(); 
  17.  
  18.     var hours = dt.getHours();     
  19.     var ampm = (hours > 11) ? " PM " : " AM "; 
  20.     if (hours > 12) hours -= 12; //If it's afternoon, subtract 12 to reset to 12hour scale. 
  21.     if (hours == 0) hours = 12;  //If it's midnight, show 12. 
  22.  
  23.     var now = hours + ":" + (100+dt.getMinutes()) + ":" + (100+dt.getSeconds()) + ampm + " "
  24.               + days[dt.getDay()] + months[dt.getMonth()] + dt.getDate() + ", " + dt.getFullYear(); 
  25.  
  26.     document.getElementById("datetime").innerHTML = now.replace( /\:1/g, ":" ); 
  27.  
  28.     setTimeout( "dt()", 1000 ); 
  29.  
  30. And here's a link to the page: http://rsteph49.tripod.com/default.shtml
  31.  
  32. Here's the code:
  33.  
  34. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  35. <html>
  36.  
  37.     <head>
  38.         <title>Clermont Christian Church</title>
  39.         <link href="styles.css" rel="stylesheet" type="text/css" />
  40.             <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
  41.             <meta name="description" content="This is the website homepage" />
  42.             <meta name="keywords" content="Christian, Indiana, Church, Clermont, Religion, Indianapolis, Sunday, School" />
  43.  
  44.             <style type="text/css" media="all">
  45.                 @import "style.css";
  46.             </style>
  47.  
  48. <script type="text/javascript" language="JavaScript1.2" src="/java_scripts/coolmenus4.js"></script>
  49. <script type="text/javascript" language="JavaScript1.2" src="/java_scripts/cm_addins.js"></script>
  50. <script type="text/javascript" language="javascript1.2" src="/java_scripts/sniffer.js">
  51.  
  52. /***********************************************
  53. * Top Navigational Bar III v3.5 (By BrotherCake- brothercake.com)
  54. * Exclusive permission by Dynamicdrive.com to include script in archive
  55. * For this and 100's more DHTML scripts, visit http://www.dynamicdrive.com/
  56. * This notice MUST stay intact for legal use
  57. ***********************************************/
  58.  
  59. </script>
  60.  
  61. <script type="text/javascript" language="javascript1.2" src="/java_scripts/basic_datetime.js"></script>
  62. <script type="text/javascript" language="javascript1.2" src="/java_scripts/custom.js"></script>
  63. <script type="text/javascript" language="javascript1.2" src="/java_scripts/style.js"></script>
  64.  
  65. </head>
  66.  
  67. <body id="body" onLoad="dt()">
  68.  
  69.     <div id="bannercontent">
  70.         <img src="/images/header.jpg" alt="" />
  71.     </div>
  72.  
  73.     <div id="menucontent">
  74.         <script type="text/javascript" language="javascript1.2" src="/java_scripts/menu.js"></script>
  75.     </div>
  76.  
  77.         <div id="datetime"></div>
  78.  
  79.         <div id="bodycontent">
  80.             <table border="0" cellpadding="25" cellspacing="0" bordercolor="#FF33FF" bgcolor="#ffffff" width="900" align="center">
  81.             <tr>
  82.                 <td align="left">
  83.                     <table border="8" cellpadding="0" cellspacing="0" align="center" bordercolor="#0000cc" bordercolordark="#000066" bordercolorlight="#0066ff">
  84.                     <tr>
  85.                         <td width="815" height="250" align="left" valign="top">
  86.                             <h1>Clermont Christian Church</h1>
  87.  
  88.                             <p>Welcome to our church&acute;s internet home!  You may have stopped here on purpose, or you may have gotten here by accident, but either way, we&acute;re glad you&acute;re here!</p>
  89.                             <br />
  90.                             <p>We are in the business of connecting people to God and connecting people to one another so that life can be all that God intends!  As you look around our site, we hope you&acute;ll find helpful information about CCC and get to know a little bit about who we are.  We&acute;d love to see you face to face sometime, so feel free to stop in to one of our services anytime, or introduce yourself as you see us out in the community.  We are praying for you!</p>
  91.                         </td>
  92.                     </tr>
  93.                     </table>
  94.                 </td>
  95.             </tr>
  96.  
  97.             <tr>
  98.                 <td>
  99.                 <table border="0" cellpadding="5" cellspacing="0" align="center" bordercolor="#ff00cc">
  100.                     <tr>
  101.                         <td width="400" height="400" align="center" valign="middle">
  102.                             <table border="8" cellpadding="0" cellspacing="0" align="center" bordercolor="#0000cc" bordercolordark="#000066" bordercolorlight="#0066ff"><tr><td width="400" height="400" align="center" valign="middle">
  103.                                 <img src="/images/christmasshow2.gif" align="absmiddle" border="0" alt="" />
  104.                             </td></tr></table>
  105.                         </td>
  106.                         <td width="400" height="400" align="center" valign="middle">
  107.                             <table border="8" cellpadding="0" cellspacing="0" align="center" bordercolor="#0000cc" bordercolordark="#000066" bordercolorlight="#0066ff"><tr><td width="400" height="400" align="center" valign="middle">
  108.                                 <img src="/images/services.gif" align="absmiddle"  border="0" alt="" />
  109.                             </td></tr></table>
  110.                         </td>
  111.                     </tr>
  112.  
  113.                     <tr>
  114.                         <td width="400" height="200" align="center" valign="middle">
  115.                             <table border="8" cellpadding="0" cellspacing="0" align="center" bordercolor="#0000cc" bordercolordark="#000066" bordercolorlight="#0066ff"><tr><td width="400" height="250" align="center" valign="middle">
  116.                                 <p class="announceHeader">Discovering Clermont #101:</p>
  117.                                 <p class="announceBody">Date: November 12<br />
  118.                                 Time: Immediately after the 10:30am service</p>
  119.                                 <p class="announceBody">This class is designed to introduce newcomers to our church's mission and ministry.</p>
  120.                                 <p class="announceHL" style="color: #990000">Lunch & Childcare will be provided</p>
  121.                             </td></tr></table>
  122.                         </td>
  123.                         <td width="400" height="200" align="center" valign="middle">
  124.                             <table border="8" cellpadding="0" cellspacing="0" align="center" bordercolor="#0000cc" bordercolordark="#000066" bordercolorlight="#0066ff"><tr><td width="400" height="250" align="center" valign="middle">
  125.                                 <p class="announceHeader">Thanksgiving Dinner</p>
  126.                                 <p class="announceBody">Date: November 19<br />
  127.                                 Time: Immediately after the 10:30am service</p>
  128.                                 <p class="announceBody">The dinner will be held in the Community Life Center, sign-up sheets are on the bulletin board in the foyer.</p>
  129.                                 <p class="announceHL">HELP IS REALLY NEEDED in some areas!!</p>
  130.                             </td></tr></table>
  131.                         </td>
  132.                     </tr>
  133.                 </table>
  134.                 </td>
  135.             </tr>
  136.  
  137.             </table>
  138.         </div>
  139.  
  140.         <div id="footer">
  141.     <p>Clermont Christian Church / Clermont, Indiana</p>
  142. </div>
  143.  
  144.  
  145.     </body>
  146.  
  147. </html>
  148. <!-- ********************************************************** -->
  149. <!-- * START TRIPOD AD CODE - PLEASE REMOVE WHEN EDITING PAGE * -->
  150. <!-- ********************************************************** -->
  151.  
  152. <!-- revision: new - $Change: 88678 $ -->
  153.  
  154. <script type="text/javascript" src="http://hb.lycos.com/hb.js"></script>
  155. <script type="text/javascript">
  156. var cm_role = "live";
  157. var cm_host = "tripod.lycos.com";
  158. var cm_taxid = "/memberembedded";
  159.  
  160. var lycos_ad_category = null;
  161.  
  162. var lycos_ad_remote_addr = "67.98.138.34";
  163. var lycos_ad_www_server = "www.tripod.lycos.com";
  164. var lycos_ad_track_small = "http://members.tripod.com/adm/img/common/ot_smallframe.gif?rand=200387";
  165. var lycos_ad_track_served = "http://members.tripod.com/adm/img/common/ot_adserved.gif?rand=200387";
  166. </script>
  167. <script type="text/javascript" src="http://scripts.lycos.com/catman/init.js"></script>
  168. <script type="text/javascript" src="http://members.tripod.com/adm/ad/code-start.js"></script>
  169. <script type="text/javascript" src="http://members.tripod.com/adm/ad/code-middle.js"></script>
  170. <script type="text/javascript" src="http://members.tripod.com/adm/ad/code-end.js"></script>
  171. <noscript>
  172. <img src="http://members.tripod.com/adm/img/common/ot_noscript.gif?rand=200387" alt="" width="1" height="1" />
  173. <img src="http://lycos.247realmedia.com/data/?tax0_SiteID=2&amp;nojs=true" alt="" width="1" height="1" />
  174. <a href="http://network.realmedia.com/RealMedia/ads/click_nx.ads/lycostripod/ros/728x90/wp/ss/a/200387@Top1?x"><img border="0" src="http://network.realmedia.com/RealMedia/ads/adstream_nx.ads/lycostripod/ros/728x90/wp/ss/a/200387@Top1" alt="leaderboard ad" /></a>
  175. </noscript>
  176.  
  177. <!-- revision: new - $Change: 88678 $ -->
  178.  
  179. <!-- ******************************************************** -->
  180. <!-- * END TRIPOD AD CODE - PLEASE REMOVE WHEN EDITING PAGE * -->
  181. <!-- ******************************************************** -->
  182.  
Nov 8 '06 #1
Share this Question
Share on Google+
3 Replies


ronverdonk
Expert 2.5K+
P: 4,258
When you assume that I will wade through this bunch (180 lines) of unstructured code (not enclosed in code or html tags), you better think twice!

Ronald :cool:
Nov 8 '06 #2

P: 71
I'm sorry I've not posted that often on here before, and never used the code and html tags options that they have. Let me try reposting that here with those tags in place, see if that helps with reading it any.

When you assume that I will wade through this bunch (180 lines) of unstructured code (not enclosed in code or html tags), you better think twice!

Ronald :cool:
Nov 9 '06 #3

P: 71
I have a script that shows the time and date. It's been working on my site for quite a while now. Suddenly it stops showing up, after getting my drop down menu to work.

If I put text between the <div id="datetime"></div> tags, the text shows up, but the javascript output being sent to those some divs doesn't seem to want to work. It should be showing up in the middle of the content pane, just below the first table box. (set by .css)

Here's the script:

Expand|Select|Wrap|Line Numbers
  1.  
  2. //Original: Xavier R. (xav@lougaou.com)
  3. //Modified: Benjamin Wright, Editor
  4. //Web Site: http://www.lougaou.com/
  5.  
  6. //This script and many more are available free online at The JavaScript Source!!
  7. //http://javascript.internet.com
  8.  
  9. var days = new Array("Sun, ","Mon, ","Tue, ","Wed, ","Thu, ","Fri, ","Sat, "); 
  10. var months = new Array("Jan ","Feb ","Mar ","Apr ","May ","Jun ", 
  11. "Jul ","Aug ","Sep ","Oct ","Nov ","Dec " ); 
  12.  
  13. function dt( ) 
  14. // if browser doesn't support getElementById, 
  15. // then it won't support CSS...so forget it 
  16. if ( document.getElementById == null ) return; 
  17. var dt = new Date(); 
  18.  
  19. var hours = dt.getHours(); 
  20. var ampm = (hours > 11) ? " PM " : " AM "; 
  21. if (hours > 12) hours -= 12; //If it's afternoon, subtract 12 to reset to 12hour scale. 
  22. if (hours == 0) hours = 12; //If it's midnight, show 12. 
  23.  
  24. var now = hours + ":" + (100+dt.getMinutes()) + ":" + (100+dt.getSeconds()) + ampm + " "
  25. + days[dt.getDay()] + months[dt.getMonth()] + dt.getDate() + ", " + dt.getFullYear(); 
  26.  
  27. document.getElementById("datetime").innerHTML = now.replace( /\:1/g, ":" ); 
  28.  
  29. setTimeout( "dt()", 1000 ); 
  30.  
And here's a link to the page: http://rsteph49.tripod.com/default.shtml

Here's the code:

[HTML]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>

<head>
<title>Clermont Christian Church</title>
<link href="styles.css" rel="stylesheet" type="text/css" />
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta name="description" content="This is the website homepage" />
<meta name="keywords" content="Christian, Indiana, Church, Clermont, Religion, Indianapolis, Sunday, School" />

<style type="text/css" media="all">
@import "style.css";
</style>

<script type="text/javascript" language="JavaScript1.2" src="/java_scripts/coolmenus4.js"></script>
<script type="text/javascript" language="JavaScript1.2" src="/java_scripts/cm_addins.js"></script>
<script type="text/javascript" language="javascript1.2" src="/java_scripts/sniffer.js">

/***********************************************
* Top Navigational Bar III v3.5 (By BrotherCake- brothercake.com)
* Exclusive permission by Dynamicdrive.com to include script in archive
* For this and 100's more DHTML scripts, visit http://www.dynamicdrive.com/
* This notice MUST stay intact for legal use
***********************************************/

</script>

<script type="text/javascript" language="javascript1.2" src="/java_scripts/basic_datetime.js"></script>
<script type="text/javascript" language="javascript1.2" src="/java_scripts/custom.js"></script>
<script type="text/javascript" language="javascript1.2" src="/java_scripts/style.js"></script>

</head>

<body id="body" onLoad="dt()">

<div id="bannercontent">
<img src="/images/header.jpg" alt="" />
</div>

<div id="menucontent">
<script type="text/javascript" language="javascript1.2" src="/java_scripts/menu.js"></script>
</div>

<div id="datetime"></div>

<div id="bodycontent">
<table border="0" cellpadding="25" cellspacing="0" bordercolor="#FF33FF" bgcolor="#ffffff" width="900" align="center">
<tr>
<td align="left">
<table border="8" cellpadding="0" cellspacing="0" align="center" bordercolor="#0000cc" bordercolordark="#000066" bordercolorlight="#0066ff">
<tr>
<td width="815" height="250" align="left" valign="top">
<h1>Clermont Christian Church</h1>

<p>Welcome to our church&acute;s internet home! You may have stopped here on purpose, or you may have gotten here by accident, but either way, we&acute;re glad you&acute;re here!</p>
<br />
<p>We are in the business of connecting people to God and connecting people to one another so that life can be all that God intends! As you look around our site, we hope you&acute;ll find helpful information about CCC and get to know a little bit about who we are. We&acute;d love to see you face to face sometime, so feel free to stop in to one of our services anytime, or introduce yourself as you see us out in the community. We are praying for you!</p>
</td>
</tr>
</table>
</td>
</tr>

<tr>
<td>
<table border="0" cellpadding="5" cellspacing="0" align="center" bordercolor="#ff00cc">
<tr>
<td width="400" height="400" align="center" valign="middle">
<table border="8" cellpadding="0" cellspacing="0" align="center" bordercolor="#0000cc" bordercolordark="#000066" bordercolorlight="#0066ff"><tr><td width="400" height="400" align="center" valign="middle">
<img src="/images/christmasshow2.gif" align="absmiddle" border="0" alt="" />
</td></tr></table>
</td>
<td width="400" height="400" align="center" valign="middle">
<table border="8" cellpadding="0" cellspacing="0" align="center" bordercolor="#0000cc" bordercolordark="#000066" bordercolorlight="#0066ff"><tr><td width="400" height="400" align="center" valign="middle">
<img src="/images/services.gif" align="absmiddle" border="0" alt="" />
</td></tr></table>
</td>
</tr>

<tr>
<td width="400" height="200" align="center" valign="middle">
<table border="8" cellpadding="0" cellspacing="0" align="center" bordercolor="#0000cc" bordercolordark="#000066" bordercolorlight="#0066ff"><tr><td width="400" height="250" align="center" valign="middle">
<p class="announceHeader">Discovering Clermont #101:</p>
<p class="announceBody">Date: November 12<br />
Time: Immediately after the 10:30am service</p>
<p class="announceBody">This class is designed to introduce newcomers to our church's mission and ministry.</p>
<p class="announceHL" style="color: #990000">Lunch & Childcare will be provided</p>
</td></tr></table>
</td>
<td width="400" height="200" align="center" valign="middle">
<table border="8" cellpadding="0" cellspacing="0" align="center" bordercolor="#0000cc" bordercolordark="#000066" bordercolorlight="#0066ff"><tr><td width="400" height="250" align="center" valign="middle">
<p class="announceHeader">Thanksgiving Dinner</p>
<p class="announceBody">Date: November 19<br />
Time: Immediately after the 10:30am service</p>
<p class="announceBody">The dinner will be held in the Community Life Center, sign-up sheets are on the bulletin board in the foyer.</p>
<p class="announceHL">HELP IS REALLY NEEDED in some areas!!</p>
</td></tr></table>
</td>
</tr>
</table>
</td>
</tr>

</table>
</div>

<div id="footer">
<p>Clermont Christian Church / Clermont, Indiana</p>
</div>


</body>

</html>
<!-- ************************************************** ******** -->
<!-- * START TRIPOD AD CODE - PLEASE REMOVE WHEN EDITING PAGE * -->
<!-- ************************************************** ******** -->

<!-- revision: new - $Change: 88678 $ -->

<script type="text/javascript" src="http://hb.lycos.com/hb.js"></script>
<script type="text/javascript">
var cm_role = "live";
var cm_host = "tripod.lycos.com";
var cm_taxid = "/memberembedded";

var lycos_ad_category = null;

var lycos_ad_remote_addr = "67.98.138.34";
var lycos_ad_www_server = "www.tripod.lycos.com";
var lycos_ad_track_small = "http://members.tripod.com/adm/img/common/ot_smallframe.gif?rand=200387";
var lycos_ad_track_served = "http://members.tripod.com/adm/img/common/ot_adserved.gif?rand=200387";
</script>
<script type="text/javascript" src="http://scripts.lycos.com/catman/init.js"></script>
<script type="text/javascript" src="http://members.tripod.com/adm/ad/code-start.js"></script>
<script type="text/javascript" src="http://members.tripod.com/adm/ad/code-middle.js"></script>
<script type="text/javascript" src="http://members.tripod.com/adm/ad/code-end.js"></script>
<noscript>
<img src="http://members.tripod.com/adm/img/common/ot_noscript.gif?rand=200387" alt="" width="1" height="1" />
<img src="http://lycos.247realmedia.com/data/?tax0_SiteID=2&amp;nojs=true" alt="" width="1" height="1" />
<a href="http://network.realmedia.com/RealMedia/ads/click_nx.ads/lycostripod/ros/728x90/wp/ss/a/200387@Top1?x"><img border="0" src="http://network.realmedia.com/RealMedia/ads/adstream_nx.ads/lycostripod/ros/728x90/wp/ss/a/200387@Top1" alt="leaderboard ad" /></a>
</noscript>

<!-- revision: new - $Change: 88678 $ -->

<!-- ************************************************** ****** -->
<!-- * END TRIPOD AD CODE - PLEASE REMOVE WHEN EDITING PAGE * -->
<!-- ************************************************** ****** -->
[/HTML]
Nov 9 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.