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

Ie throws me an "object does not support this property or method" error

P: 2
The code seems to work fine in other browser but in IE it throws this error. This is very urgent for me and any help would be greatly appreciated
For your convienence i have posted the code for the file. The portion that is not working is the star rating part


Expand|Select|Wrap|Line Numbers
  1. <?php 
  2. session_start();
  3. include_once('includes/host_conf.php');
  4. include_once('includes/db_connect.php');
  5. include_once('includes/mysql.lib.php');
  6. include_once("includes/functions.php");
  7. /*include_once("includes/siteconfig.php");*/
  8. include_once("fckeditor/fckeditor.php");
  9. include_once("includes/class-paging.php");
  10. $entity_id=$_GET['entity'];
  11. $query="SELECT * FROM `tbl_entity` WHERE `id`='$entity_id' AND `isActive`=1";
  12. $objView=mysql_query($query);
  13. $entity=mysql_fetch_array($objView);
  14. $array_session=$_SESSION['entity'];
  15. $array_rate=$_SESSION['rated'];
  16.  
  17.  
  18. /* increase views */
  19. $browserid = session_id();
  20. $checkforsession = "select * from `tbl_entity_impressions` where `entity_id` = '".$entity_id."' && `session_id` = '".$browserid."'";
  21. $checksessres = mysql_query($checkforsession) or die(mysql_error());
  22. if(mysql_num_rows($checksessres) == 0)
  23. {
  24.     mysql_query("Insert into `tbl_entity_impressions` (`entity_id`,`imp_date`,`session_id`) values ('".$entity_id."',NOW(),'".$browserid."')");
  25. ?>
  26. <?php # for google map integration ?>
  27.  
  28. <link rel="stylesheet" type="text/css" href="styles/stars.css" />
  29.  
  30. <script type="text/javascript" language="javascript">
  31. function toggleCommentDiv()
  32. {
  33.     if(document.getElementById('commentBox').style.display == "none")
  34.     {
  35.         document.getElementById('commentBox').style.display = "block";
  36.     } else {
  37.         document.getElementById('commentBox').style.display = "none";
  38.     }
  39. }
  40. </script> 
  41. <style type="text/css">
  42. #star ul.star { LIST-STYLE: none; MARGIN: 0; PADDING: 0; WIDTH: 85px; HEIGHT: 20px; LEFT: 10px; TOP: -5px; POSITION: relative; FLOAT: left; BACKGROUND: url('media/stars.gif') repeat-x; CURSOR: pointer; }
  43. #star li { PADDING: 0; MARGIN: 0; FLOAT: left; DISPLAY: block; WIDTH: 85px; HEIGHT: 20px; TEXT-DECORATION: none; text-indent: -9000px; Z-INDEX: 20; POSITION: absolute; PADDING: 0; }
  44. #star li.curr { BACKGROUND: url('media/stars.gif') left 25px; FONT-SIZE: 1px; }
  45. #star div.user { LEFT: 15px; POSITION: relative; FLOAT: left; FONT-SIZE: 13px; FONT-FAMILY: Arial; COLOR: #888; }
  46. </style>
  47. <script language="javascript" src="js/jquery.js"></script>
  48. <script type="text/javascript">
  49.  
  50. /* AJAX Star Rating : v1.0.3 : 2008/05/06 */
  51. /* http://www.nofunc.com/AJAX_Star_Rating/ */
  52.  
  53. //function $(v,o) { return((typeof(o)=='object'?o:document).getElementById(v)); }
  54. function $S(o) { return((typeof(o)=='object'?o:$(o).get(0)).style); }
  55. function agent(v) { return(Math.max(navigator.userAgent.toLowerCase().indexOf(v),0)); }
  56. function abPos(o) { var o=(typeof(o)=='object'?o:$(o).get(0)), z={X:0,Y:0}; while(o!=null) { z.X+=o.offsetLeft; z.Y+=o.offsetTop; o=o.offsetParent; }; return(z); }
  57. function XY(e,v) { var o=agent('msie')?{'X':event.clientX+document.body.scrollLeft,'Y':event.clientY+document.body.scrollTop}:{'X':e.pageX,'Y':e.pageY}; return(v?o[v]:o); }
  58.  
  59. star={};
  60.  
  61. star.mouse=function(e,o) { if(star.stop || isNaN(star.stop)) { star.stop=0;
  62.  
  63.     document.onmousemove=function(e) { var n=star.num;
  64.  
  65.         var p= $('#star'+n).offset();
  66.         p.X = p.left;
  67.         p.Y = p.top;
  68.         /*abPos($('star'+n))*/
  69.         var x=XY(e), oX=x.X-p.X, oY=x.Y-p.Y; star.num=o.id.substr(4);
  70.  
  71.         if(oX<1 || oX>84 || oY<0 || oY>19) {star.stop=1; star.revert();}
  72.         else {
  73.             $('#starCur'+n).width=oX+'px';
  74.             /*$S('starUser'+n).color='#111';*/
  75.             $('#starUser'+n).html(Math.round(oX/84*100)+'%');
  76.         }
  77.     };
  78. } };
  79.  
  80. star.update=function(e,o){
  81.     var n=star.num, v=parseInt($('#starUser'+n).html());
  82.     n=o.id.substr(4);
  83.     $('#starCur'+n).attr("title",v);
  84.     entity=$('#entity').val();
  85.     //document.getElementById('entity').value();
  86.  
  87.     req=new XMLHttpRequest(); 
  88.     req.open('GET','rate.php?rate='+(v/100)+'&entity='+entity,true);
  89.     req.onreadystatechange=function() {
  90.  
  91.     if (req.readyState==4) {
  92.     var content =req.responseText;
  93.  
  94.  
  95.     /*if(content=="alreadyrated")
  96.         alert('You have already rated');
  97.     else
  98.     {
  99.         $('#star0').onmousedown='';
  100.         $('#star0').onmousemove='';
  101.         $('#starCur0').width((content)*0.84+'px');
  102.         $('#starUser0').html(content+'%');
  103.     }*/
  104.     }
  105.     }
  106.      req.send(null);    
  107. };
  108.  
  109. star.revert=function() { var n=star.num, v=parseInt($('#starCur'+n).attr("title"));
  110.  
  111.     $S('#starCur'+n).width=Math.round(v*84/100)+'px';
  112.     $('#starUser'+n).html((v>0?Math.round(v)+'%':''));
  113.     /*$('starUser'+n).style.color='#888';*/
  114.     document.onmousemove='';
  115.  
  116. };
  117. star.num=0;
  118.  
  119. </script>
  120.   <!--<script language="javascript" src="js/jquery.js"></script>-->
  121.    <script language="javascript" src="js/maps.js"></script>
  122.  
  123.  
  124.  <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAQ3YasKs4tVSFNLnBHcoc9BQXoWTeVHG3tesCQp217h9v9z8m9RQByWgRMwdvIYJoKuaYoYbZTg3KfA" type="text/javascript">
  125.  GUnload();
  126. </script>
  127. <table width="100%" border="0" cellpadding="0" cellspacing="0" class="form_tbl">
  128.  
  129.   <tr>
  130.     <td colspan="2">
  131.       <table width="100%" border="0">
  132.         <tr>
  133.           <td><H2 style="display:inline-block;"><?php echo stripslashes($entity['name']);?></span></H2></td>
  134.           <td style="text-align:right"><span><a href="<?php echo $_SERVER['HTTP_REFERER'];?>">Back</a></span></td>
  135.         </tr>
  136.       </table>      </td>
  137.   </tr>
  138.    <tr>
  139.      <td width="201" valign="top" style="width:100px; padding-right:10px; text-align:center">
  140.      <?php if($entity['logo']!='') { ?>
  141.     <img src="http://bytes.com/submit/304/includes/phpthumb/gallery/entity/<?php echo $entity['logo'];?>&w=100&h=100" border="0" />
  142.     <?php } else { ?>
  143.     <img src="admin_image/images.jpeg" border="0" />
  144.     <?php } ?> </td>
  145.      <td width="525"><?php echo stripslashes(html_entity_decode($entity['description'])) ;?></td>
  146.   </tr>
  147.    <tr>
  148.      <td colspan="2" style="width:100px; padding-right:10px; text-align:center;">&nbsp;</td>
  149.    </tr>
  150. <?php //if($entity['map']!='') { ?>   
  151.     <tr>
  152.      <td colspan="2" style=" border:0px solid #000000; padding-right:10px; text-align:center;"> 
  153.     <?php /*?><img src="gallery/entity/<?php echo $entity['map'];?>" border="0" /><?php */?>
  154.     <?php //for google api
  155.         $location=explode(',',$entity['location']);
  156.         $loc=googleCountry($location[0], $location[1], $location[2]);
  157.     ?>
  158. <div id="event_map_address"><?php echo  $entity['location'] ?></div>
  159. <div class="google-map-container" id="event-map" style="width:688px;height:400px;overflow: hidden; border:0;">
  160. <?php 
  161. //$latitude  =$loc[2];
  162. //$longitude =$loc[3];
  163. //include_once("googleMap.html");
  164. //include_once("gMap/smallgooglemap.html");
  165. ?>
  166. </div>
  167.  
  168.   </td>
  169.    </tr>
  170.   <?php //} ?>
  171.    <tr>
  172.      <td>&nbsp;</td>
  173.      <td>&nbsp;</td>
  174.    </tr>
  175.   <tr>
  176.     <td style=" font-weight:bold; color:#FBC610; font-family:Verdana, Arial, Helvetica, sans-serif;">Contact Details</td>
  177.     <td align="left">&nbsp;</td>
  178.   </tr>
  179.  
  180.   <tr>
  181.     <td>Location :</td>
  182.     <td align="left"><?php echo $entity['location'];?></td>
  183.   </tr>
  184.  
  185.   <tr>
  186.     <td>Contact Number:</td>
  187.     <td align="left"><?php echo $entity['contact_no'];?></td>
  188.   </tr>
  189.   <tr>
  190.     <td>E-mail :</td>
  191.     <td align="left"><a href="mailto:<?php echo $entity['email'];?>"><?php echo $entity['email'];?></a></td>
  192.   </tr>
  193.   <tr>
  194.     <td>Web URL :</td>
  195.     <td align="left"><a href="<?php echo $entity['url'] ?>" target="_blank"><?php echo $entity['url'];?></a></td>
  196.   </tr>
  197.  
  198.   <tr>
  199.     <td>Opening Hours :</td>
  200.     <td align="left"><?php echo $entity['time'];?></td>
  201.   </tr>
  202.   <tr>
  203.     <td>Featured in :</td>
  204.     <td align="left">
  205.     <table width="100%" border="0" cellspacing="0" cellpadding="0">
  206.           <tr>
  207.             <?php echo ($entity['isFeatured']==0)?'':'<td>Category</td>';?>
  208.             <?php echo ($entity['isFeatured_last']==0)?'':'<td>Last week</td>';?>
  209.             <?php echo ($entity['isFeatured_new']==0)?'':'<td>New and Noteworthy</td>';?>          </tr>
  210.         </table>    </td>
  211.   </tr>
  212.   <tr>
  213.     <td>Price Chart :</td>
  214.     <td align="left">&nbsp;
  215.   </tr>
  216.       <tr>
  217.     <td colspan="2">
  218.     <table  cellspacing="2" cellpadding="0" border="0">
  219.     <tr>
  220.   <?php
  221.  if($entity_id == 55)
  222.  {
  223.        $tablestring ="<table  cellspacing='1' cellpadding='2' border='0' style='background-color:#FFFEED; border:2px dashed red;color:black'>
  224. <tr>
  225. <td style='text-align:center'>
  226. <img src='images/benlogo1.gif'>
  227. </td>
  228. </tr>
  229. <tr>
  230. <td style='text-align:center'>
  231. BUY ONE MEAL AT FULL PRICE GET SECOND MEAL HALF OFF!<br />
  232. EAT IN ONLY NO TAKE OUT.
  233. </td>
  234. </tr> 
  235. </table><table cellspacing='0' cellpadding='0' border = '0'>
  236. <td>
  237.       <a style='color:#FFFFFF; cursor:pointer' href='couponprint.php'><img src='images/print.gif' />Print this coupon</a>
  238.       </td>
  239.       </tr>
  240. </table>
  241. ";
  242. $maincontent = $entity['price_chart'].",".$tablestring;
  243. } else if($entity_id == 56)
  244. {
  245.     if($entity['price_chart'] != "")  
  246.     {
  247.             $tablestring = "  
  248.   <tr>
  249.     <td style='text-align:left'><a href='theresaprint.php?img=buy1get1' target='_blank'><img src='gallery/entity/theresa/Buy1Get1.jpg'></a></td>
  250.     <td style='text-align:left'><a href='theresaprint.php?img=20offc' target='_blank'><img src='gallery/entity/theresa/20offCoupon.jpg'></a></td>
  251.   </tr>
  252.   <tr>
  253.     <td style='text-align:left'><a href='theresaprint.php?img=5offc' target='_blank'><img src='gallery/entity/theresa/5offCoupon.jpg'></a></td>
  254.     <td>&nbsp;</td>
  255.   </tr>
  256.     ";
  257.         $maincontent = $entity['price_chart'].",".$tablestring;
  258.     } else {
  259.             $tablestring = "
  260.     <table cellspacing='1' cellpadding='2' border='0' >
  261.   <tr>
  262.     <td style='text-align:left'><a href='theresaprint.php?img=buy1get1' target='_blank'><img src='gallery/entity/theresa/Buy1Get1.jpg'></a></td>
  263.     <td style='text-align:left'><a href='theresaprint.php?img=20offc' target='_blank'><img src='gallery/entity/theresa/20offCoupon.jpg'></a></td>
  264.   </tr>
  265.   <tr>
  266.     <td style='text-align:left'><a href='theresaprint.php?img=5offc' target='_blank'><img src='gallery/entity/theresa/5offCoupon.jpg'></a></td>
  267.     <td>&nbsp;</td>
  268.   </tr>
  269. </table>
  270.     ";
  271.         $maincontent = $tablestring;        
  272.     }
  273. } else {
  274.     $maincontent = $entity['price_chart'];
  275. }
  276.       $entpicarr = explode(",",$maincontent);
  277.     $count = 0;
  278.     for($i=0;$i<sizeof($entpicarr);$i++)
  279.     {
  280.         $count = $count+1;
  281.     ?>
  282.  
  283.         <td >
  284.         <?php if($entpicarr[$i] !='' && $i != sizeof($entpicarr)-1) { ?>
  285.         <a href="showmenu.php?entid=<?php echo $entity_id ?>&amp;imgname=<?php echo $entpicarr[$i]?>" target="_blank">
  286.             <!--<a href="./gallery/entity/<?php echo $entpicarr[$i]?>" target="_blank"> -->
  287.              <img src="http://bytes.com/submit/304/includes/phpthumb/gallery/entity/<?php echo $entpicarr[$i];?>&w=800&h=400" border="0" />    </a>
  288.             <?php } elseif ($i == sizeof($entpicarr)-1 && ($entity_id == 55 || $entity_id == 56))
  289.             {
  290.             echo $entpicarr[$i];
  291.             }
  292.              ?>        </td>
  293.          <?php
  294.            if($count == 2) {
  295.            echo "</tr><tr>";
  296.            $count = 0;
  297.            }
  298.     }
  299.     if($count >0)
  300.     echo "</tr>";
  301.   ?>
  302.   </table>
  303.   </td>
  304.   </tr>
  305.   <?php
  306.       /*if(@in_array($entity_id,$array_session))
  307.         {
  308.             $rate=$_SESSION['rated'][$entity_id];
  309.             $clicks=$_SESSION['clicks'][$entity_id];
  310.             if($clicks=='' || $clicks==0)
  311.             { $clicks=1;}
  312.             $rated_value=$rate/$clicks;
  313.             $width=$rated_value*100;
  314.         }
  315.         else
  316.         {   
  317.             $rate_em='onmousedown="star.update(event,this)" onmousemove="star.mouse(event,this)"';
  318.             $width="0";
  319.         }*/
  320.        $rate_em='onmousedown="star.update(event,this)" onmousemove="star.mouse(event,this)"';
  321.             $width="0";
  322.  
  323.         //check if previous rating exists, if yes then show avg rating
  324.         $isRated=mysql_query("SELECT * FROM `tbl_rating` WHERE `entityId`='$entity_id'");
  325.  
  326.         if(mysql_num_rows($isRated)>0)
  327.         {
  328.             $rateCheck=mysql_query("SELECT AVG (`value`) as `avgRate` FROM `tbl_rating` WHERE `entityId`='$entity_id'") or die(mysql_error());
  329.             $avg=mysql_fetch_array($rateCheck);
  330.             $avg_width=$avg['avgRate']*100;
  331.         ?>
  332.         <tr><td>Average Rating :</td>
  333.         <td>
  334.         <div style="width:100%;"><div style="float:left"></div>
  335.          <div style="float:left;">         </div>
  336.               <div id="star" style="display: inline-block; padding-top:4px;">
  337.                <ul id="star1" class="star" title="Average Rating!" >
  338.           <li id="starCur1" class="curr" title="5" style="width:<?php echo $avg_width*0.84;?>px;"></li>
  339.         </ul>
  340.          <div style="color: rgb(136, 136, 136);display: inline-block;" id="starUser1" class="user" >
  341.          <?php echo number_format($avg_width,2)."%" ?>         </div>               
  342.         </div>
  343.         </div></td>
  344.       </tr>
  345.         <?php
  346.         }
  347.         ?>
  348.       <tr>
  349.         <td >Rate it :</td>
  350.         <td >
  351.         <div style="width:100%;"><div style="float:left"></div>
  352.          <div style="float:left;">         </div>
  353.               <div id="star" style="display: inline-block; padding-top:4px;">
  354.                <ul id="star0" class="star" <?=$rate_em?> title="Rate This!" >
  355.           <li id="starCur0" class="curr" title="5" style="width:<?php echo $width*0.84;?>px;"></li>
  356.         </ul>
  357.          <div style="color: rgb(136, 136, 136);display: inline-block;" id="starUser0" class="user" ><?php echo number_format($width,2)."%" ?>         </div>               
  358.           <input type="hidden" name="entity" id="entity" value="<?php echo $entity_id;?>">
  359.           <br style="clear: both;">
  360.         </div>
  361.         </div></td>
  362.       </tr>
  363.       <?php 
  364.   //check if its entity of restaurant
  365.   $txtrest=getInformation('tbl_category','catName',$entity['categoryId'], 'id');
  366.   $pattern='/restaurant|restaurants/i';
  367.   if(preg_match($pattern, $txtrest)) { ?>
  368.   <tr><td valign="top">Today's Special :</td><td><?php echo html_entity_decode($entity['today_specials']);?></td></tr>
  369.   <?php } 
  370.   if($entity['categoryId']==20)
  371.   {
  372.   ?>  
  373.       <tr>
  374.         <td colspan="2">Notify me Daily Specials
  375.           <form id="form1" name="form1" method="post" action="restaurant_subscriber.php?entity=<?php echo $entity_id; ?>" onsubmit="return getemailvalidation()">
  376.           <input type="text"  onclick="resettext()" name="subs_email" id="subs_email" /><input name="submit" type="submit" value="Subscribe" class="button" />
  377.           <span id="msg"><?php if($_GET['msg']=="suc") echo "Thank you for subscribing"; else if($_GET['msg']=="dup") echo "You are already in our mailing list";?></span>
  378.           </form></td>
  379.       </tr>
  380.    <?php
  381.    }
  382.    ?>
  383.       <tr><td></td><td style="text-align:right;"><a href="javascript:;" onclick="toggleCommentDiv();">Post Review</a></td></tr>
  384.       <?php
  385.       //check if comment exists then show else do nothing
  386.       $checkComment=mysql_query("SELECT * FROM `tbl_reviews` WHERE `entityId`='$entity_id' ORDER BY `id` DESC");
  387.       if(mysql_num_rows($checkComment)>0)
  388.         { ?>
  389.         <tr><td colspan="2" style="border-bottom: 1px solid #FBC610;padding:5px 0px;"><span class="yellow-text"><strong>Reviews</strong></span></td></tr>
  390.         <?php
  391.             while($comment=mysql_fetch_array($checkComment))
  392.             { 
  393.             $dateArray=explode(' ',$comment['datetime']);
  394.             ?>
  395.             <tr><td colspan="2" style="border-bottom:1px solid #999999;">
  396.             <table width="100%" border="0" cellspacing="0" cellpadding="6" >
  397.               <tr>
  398.                 <td style="width:100%; padding:3px 0px;"><strong><?php echo $comment['name'];?></strong>
  399.                 says <?php echo "\" ".$comment['review'];?> " <br />
  400.                 on <span class="yellow-text" style="font-weight:normal"><?php echo getDateFormatted($dateArray[0]) ;?></span><br /></td>
  401.               </tr>
  402.             </table>
  403.             </td></tr>
  404.             <?php
  405.             }
  406.         }
  407.       ?>
  408.   <tr>
  409.     <td colspan="2"  ><div id="commentBox" style="display:none; border-bottom:1px solid #999999;"><?php include_once("commentBox.php")?></div></td>
  410.   </tr>
  411. </table>
Aug 26 '09 #1
Share this Question
Share on Google+
2 Replies


Dormilich
Expert Mod 5K+
P: 8,639
what about the error details (line no, )?
Aug 26 '09 #2

P: 2
the line was 192 char 2

upon further inspection myself i found that the function XY(e,v) was not giving correct coordinates for IE so that value of oY would come below 0.
Aug 26 '09 #3

Post your reply

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