473,396 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Console is undefined error

ERROR IS IN console.log(columnWidth); THIS PART PLS CHECK IN CODE PLS TELL ME WHAT TOBE DONE IF I APPLIED IN OTHER WAY FROM INTERNET.

Expand|Select|Wrap|Line Numbers
  1. <?php 
  2. require_once realpath(APPLICATION_PATH .  '/services/Constants.php');
  3. require_once realpath(APPLICATION_PATH .  '/services/CDHelper.php');
  4.  
  5. ?>
  6. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  7. <html xmlns="http://www.w3.org/1999/xhtml">
  8.     <head>
  9.         <title>C+D Phone Reporting System</title>
  10.         <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type" />
  11.         <link rel="stylesheet" type="text/css" href="/Style/Style1.css" media="all" />
  12.         <script language="javascript" type="text/javascript" src="/javascript/cdreporting.js"></script>
  13.         <script language="javascript" type="text/javascript" src="/javascript/jquery-1.6.4.min.js"></script>
  14.  
  15.  
  16.  
  17. <script>
  18. $(window).load(function() {
  19.     var columnWidth = 0;
  20.     var docwidth = $(document).width();
  21.     $('.header div').each(function(){
  22.         columnWidth+=parseInt($(this).width());
  23.     })
  24.     $('#myTable').width(columnWidth);
  25.     console.log(columnWidth);
  26.  
  27.  
  28. });
  29. </script>
  30.     </head>
  31.     <body>
  32.         <form name="form" method="post">
  33.  
  34. <?php 
  35.             $count = Count($this->paginator);        
  36.             if($count != '0'){ 
  37. ?>
  38. <div style="float: left;overflow-x: scroll; width: 100%; height: 650px; background-color:#ffffff;">
  39. <div>
  40.     <div class="gen-462" align="right"><a href="javascript: self.close ()"><strong>Close</strong></a>&nbsp;&nbsp;</div>
  41. <div>
  42.     <div class="reps-4-1hCR">
  43.     <div align="center" class="Hed reps-4-1p"></div>
  44.   </div>
  45. </div>
  46. </div>  
  47.   <table border="0" cellspacing="0" cellpadding="0" id="myTable">
  48.   <tr><td>
  49.     <div align="center" class="Hed"><input type="hidden" name="pageno" id="pageno" value="1"></input>Course Report</div>
  50.     <div align="center" class="Hed">
  51.         <hr noshade="noshade"  />
  52.     </div>
  53.   </td></tr>
  54.     <tr valign="top">
  55.         <td><div class="header">
  56.           <div class="feed-header-slno"><strong>Sl No</strong></div>
  57.           <div class="feed-header"><strong class="gen-461">First Name</strong></div>
  58.           <div class="feed-header"><strong class="gen-461">Surname</strong></div>
  59.           <div class="feed-header"><strong class="gen-461">Modules Attempted</strong></div>
  60. <?php foreach ($this->moduleheader as $moduledetails) {?>
  61.                         <div class="feed-header"><strong class="gen-461"><?php echo $moduledetails['name'] . ' Result'; ?></strong></div>
  62.                         <div class="feed-header"><strong class="gen-461"><?php echo $moduledetails['name'] . ' No of times Attempted'; ?></strong></div>
  63.                         <div class="feed-header"><strong class="gen-461"><?php echo $moduledetails['name'] . ' Score'; ?></strong></div>
  64.                         <div class="feed-header"><strong class="gen-461"><?php echo $moduledetails['name'] . ' Attempted Date'; ?></strong></div>
  65. <?php } ?>
  66.         </div></td>
  67.     </tr>
  68.     <tr>
  69.       <td>
  70. <?php 
  71. //            $count = Count($this->paginator);        
  72. //            if($count != '0'){ 
  73.              $slno = ($this->paginator->getCurrentPageNumber() * 10) - 9;
  74.             $i = 0;
  75.             $prevName = '';
  76.             $prevPin  = '';
  77.  
  78.             foreach($this->paginator as $coursereportdetails){
  79.                     if($coursereportdetails['pass'] == 1){
  80.                         $modulePassRFail = 'Pass';
  81.                     } else if($coursereportdetails['pass'] == 0 && $coursereportdetails['score'] != '') {
  82.                         $modulePassRFail = 'Fail';
  83.                     } else if($coursereportdetails['pass'] == 0 && $coursereportdetails['score'] == '') {
  84.                         $modulePassRFail = '';
  85.                     }
  86.                     if($coursereportdetails['attempteddate'] == ''){
  87.                         $attemptedDate = '';
  88.                     } else {
  89.                         $attemptedDate = CDHelper::toYMDDate($coursereportdetails['attempteddate']);
  90.                     }
  91.         if($i != 0){
  92.             $name = $coursereportdetails['firstname'].$coursereportdetails['surname'];
  93.             if(!($name == $prevName && $coursereportdetails['pinno'] == $prevPin)) {
  94.                 echo "</div>";
  95.                 $slno++; ?>
  96. <?php            $j = fmod($slno,'2');
  97.                 if($j != '0') {
  98. ?>
  99.                 <div class="data-1">
  100. <?php             } else { ?>
  101.                 <div class="data-2">
  102. <?php } ?>
  103.                 <div class="feed-data-slno"><?php echo $slno; ?></div>
  104.                 <div class="feed-data"><?php echo $coursereportdetails['firstname']; ?></div>
  105.                 <div class="feed-data"><?php echo $coursereportdetails['surname']; ?></div>
  106.                 <div class="feed-data"><?php echo $coursereportdetails['modulesattempted']; ?></div>
  107.                 <div class="feed-data"><?php echo $modulePassRFail; ?></div>
  108.                 <div class="feed-data"><?php echo $coursereportdetails['attempt']; ?></div>
  109.                 <div class="feed-data"><?php echo $coursereportdetails['score']; ?></div>
  110.                 <div class="feed-data"><?php echo $attemptedDate; ?></div>
  111. <?php            $prevName = $coursereportdetails['firstname'] . $coursereportdetails['surname'];
  112.                 $prevPin  = $coursereportdetails['pinno'];
  113.  
  114.             } else { ?>
  115.                 <div class="feed-data"><?php echo $modulePassRFail; ?></div>
  116.                 <div class="feed-data"><?php echo $coursereportdetails['attempt']; ?></div>
  117.                 <div class="feed-data"><?php echo $coursereportdetails['score']; ?></div>
  118.                 <div class="feed-data"><?php echo $attemptedDate; ?></div>
  119. <?php            $prevName = $coursereportdetails['firstname'] . $coursereportdetails['surname'];
  120.                 $prevPin  = $coursereportdetails['pinno'];
  121.             }
  122.         } else { ?>
  123.             <div class="data-1">
  124.                 <div class="feed-data-slno"><?php echo $slno; ?></div>
  125.                 <div class="feed-data"><?php echo $coursereportdetails['firstname']; ?></div>
  126.                 <div class="feed-data"><?php echo $coursereportdetails['surname']; ?></div>
  127.                 <div class="feed-data"><?php echo $coursereportdetails['modulesattempted']; ?></div>
  128.                 <div class="feed-data"><?php echo $modulePassRFail; ?></div>
  129.                 <div class="feed-data"><?php echo $coursereportdetails['attempt']; ?></div>
  130.                 <div class="feed-data"><?php echo $coursereportdetails['score']; ?></div>
  131.                 <div class="feed-data"><?php echo $attemptedDate; ?></div>
  132. <?php            $prevName = $coursereportdetails['firstname'] . $coursereportdetails['surname'];
  133.                 $prevPin  = $coursereportdetails['pinno'];
  134.         }
  135.         $i++;
  136.  } ?>
  137.  
  138.  
  139.                     <div align="right" class="td resreps-8-151CR"><?php if($count != '0'){ echo $this->paginator; }?></div>
  140.       </td>
  141.     </tr>
  142.             <?php } else { ?>
  143.             <br></br><br></br><br></br><br></br><br></br>
  144.                 <div align="center"><font color="red" size="2"><?php echo RECORDS_NOT_FOUND; ?></font></div>
  145.                 <br></br><br></br><br></br>
  146.                 <?php } ?>            
  147.   </table>
  148. </div>
  149.  
  150.             <!--Main div Ends-->
  151.         </form>
  152.     </body>
  153. </html>
  154.  
Nov 16 '11 #1
1 2041
Dormilich
8,658 Expert Mod 8TB
it just means that in your browser there is no console object.

a quick’n’dirty fix can at least prevent some of the errors:
Expand|Select|Wrap|Line Numbers
  1. // prevents errors when directly calling console & console.log()
  2. if (typeof console === "undefined" || null === console) {
  3.     console = {
  4.         log: function() {}
  5.     }
  6. }
Nov 16 '11 #2

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

Similar topics

43
by: Dom | last post by:
can someone please help me display text in the console cout << "Testing"; in a different colour to the default one
5
by: Reza Roby | last post by:
The following code reports a runtime error "v has no properties." function ff() { var v; v.x=5; //error alert(v.x); } But this one alerts "undefined":
1
by: Sam Wuebben | last post by:
I've been trying to get the values of hidden fields from one of many forms on a page to load into a function. The test page is at: http;//www.mvldesign.com/test/item_pop.html The 'Add to Cart"...
0
by: Chris | last post by:
Hi all, Just converted our 95 project workspace file from VC++ 6.0 to .NET, and things have gone...um...pretty well. Down to the last of the suffering - our main server application is doing...
2
by: Michael Sanford | last post by:
I'm getting a Sysmte.IO.FileNotFoundException when executing the code below. It is straight from the example. This works on one machine, but not the other. Other benign calls invoke the same...
9
by: Alan Schroeder | last post by:
The following code produces the expected results on a PC using gcc, but I need to port it (or least something similar) to a different platform/compiler. I don't think I've introduced any undefined...
45
by: VK | last post by:
(see the post by ASM in the original thread; can be seen at <http://groups.google.com/group/comp.lang.javascript/browse_frm/thread/3716384d8bfa1b0b> as an option) As that is not in relevance to...
4
by: KC | last post by:
Hi, I don't know why this question is so hard to have an answer ? I search Google for a while ... and can't find any "good" answer. Using "throw new Error(msg)" does work ... but I believe...
3
by: Jon Davis | last post by:
Is there an app.config setting I can add or a System.Diagnostic.Process property I can tweak to cause someone else's CLR 2.0 console app to not show a base CLR dialog box offering to debug the app...
5
by: tshad | last post by:
I have the following class in my VS 2008 project that has a namespace of MyFunctions. ********************************* Imports System Imports System.Text.RegularExpressions Namespace...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.