|
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 - <?php
-
session_start();
-
include_once('includes/host_conf.php');
-
include_once('includes/db_connect.php');
-
include_once('includes/mysql.lib.php');
-
include_once("includes/functions.php");
-
/*include_once("includes/siteconfig.php");*/
-
include_once("fckeditor/fckeditor.php");
-
include_once("includes/class-paging.php");
-
$entity_id=$_GET['entity'];
-
$query="SELECT * FROM `tbl_entity` WHERE `id`='$entity_id' AND `isActive`=1";
-
$objView=mysql_query($query);
-
$entity=mysql_fetch_array($objView);
-
$array_session=$_SESSION['entity'];
-
$array_rate=$_SESSION['rated'];
-
-
-
/* increase views */
-
$browserid = session_id();
-
$checkforsession = "select * from `tbl_entity_impressions` where `entity_id` = '".$entity_id."' && `session_id` = '".$browserid."'";
-
$checksessres = mysql_query($checkforsession) or die(mysql_error());
-
if(mysql_num_rows($checksessres) == 0)
-
{
-
mysql_query("Insert into `tbl_entity_impressions` (`entity_id`,`imp_date`,`session_id`) values ('".$entity_id."',NOW(),'".$browserid."')");
-
}
-
?>
-
<?php # for google map integration ?>
-
-
<link rel="stylesheet" type="text/css" href="styles/stars.css" />
-
-
<script type="text/javascript" language="javascript">
-
function toggleCommentDiv()
-
{
-
if(document.getElementById('commentBox').style.display == "none")
-
{
-
document.getElementById('commentBox').style.display = "block";
-
} else {
-
document.getElementById('commentBox').style.display = "none";
-
}
-
}
-
</script>
-
<style type="text/css">
-
#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; }
-
#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; }
-
#star li.curr { BACKGROUND: url('media/stars.gif') left 25px; FONT-SIZE: 1px; }
-
#star div.user { LEFT: 15px; POSITION: relative; FLOAT: left; FONT-SIZE: 13px; FONT-FAMILY: Arial; COLOR: #888; }
-
</style>
-
<script language="javascript" src="js/jquery.js"></script>
-
<script type="text/javascript">
-
-
/* AJAX Star Rating : v1.0.3 : 2008/05/06 */
-
/* http://www.nofunc.com/AJAX_Star_Rating/ */
-
-
//function $(v,o) { return((typeof(o)=='object'?o:document).getElementById(v)); }
-
function $S(o) { return((typeof(o)=='object'?o:$(o).get(0)).style); }
-
function agent(v) { return(Math.max(navigator.userAgent.toLowerCase().indexOf(v),0)); }
-
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); }
-
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); }
-
-
star={};
-
-
star.mouse=function(e,o) { if(star.stop || isNaN(star.stop)) { star.stop=0;
-
-
document.onmousemove=function(e) { var n=star.num;
-
-
var p= $('#star'+n).offset();
-
p.X = p.left;
-
p.Y = p.top;
-
/*abPos($('star'+n))*/
-
var x=XY(e), oX=x.X-p.X, oY=x.Y-p.Y; star.num=o.id.substr(4);
-
-
if(oX<1 || oX>84 || oY<0 || oY>19) {star.stop=1; star.revert();}
-
else {
-
$('#starCur'+n).width=oX+'px';
-
/*$S('starUser'+n).color='#111';*/
-
$('#starUser'+n).html(Math.round(oX/84*100)+'%');
-
}
-
};
-
} };
-
-
star.update=function(e,o){
-
var n=star.num, v=parseInt($('#starUser'+n).html());
-
n=o.id.substr(4);
-
$('#starCur'+n).attr("title",v);
-
entity=$('#entity').val();
-
//document.getElementById('entity').value();
-
-
req=new XMLHttpRequest();
-
req.open('GET','rate.php?rate='+(v/100)+'&entity='+entity,true);
-
req.onreadystatechange=function() {
-
-
if (req.readyState==4) {
-
var content =req.responseText;
-
-
-
/*if(content=="alreadyrated")
-
alert('You have already rated');
-
else
-
{
-
$('#star0').onmousedown='';
-
$('#star0').onmousemove='';
-
$('#starCur0').width((content)*0.84+'px');
-
$('#starUser0').html(content+'%');
-
}*/
-
}
-
}
-
req.send(null);
-
};
-
-
star.revert=function() { var n=star.num, v=parseInt($('#starCur'+n).attr("title"));
-
-
$S('#starCur'+n).width=Math.round(v*84/100)+'px';
-
$('#starUser'+n).html((v>0?Math.round(v)+'%':''));
-
/*$('starUser'+n).style.color='#888';*/
-
document.onmousemove='';
-
-
};
-
star.num=0;
-
-
</script>
-
<!--<script language="javascript" src="js/jquery.js"></script>-->
-
<script language="javascript" src="js/maps.js"></script>
-
-
-
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAQ3YasKs4tVSFNLnBHcoc9BQXoWTeVHG3tesCQp217h9v9z8m9RQByWgRMwdvIYJoKuaYoYbZTg3KfA" type="text/javascript">
-
GUnload();
-
</script>
-
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="form_tbl">
-
-
<tr>
-
<td colspan="2">
-
<table width="100%" border="0">
-
<tr>
-
<td><H2 style="display:inline-block;"><?php echo stripslashes($entity['name']);?></span></H2></td>
-
<td style="text-align:right"><span><a href="<?php echo $_SERVER['HTTP_REFERER'];?>">Back</a></span></td>
-
</tr>
-
</table> </td>
-
</tr>
-
<tr>
-
<td width="201" valign="top" style="width:100px; padding-right:10px; text-align:center">
-
<?php if($entity['logo']!='') { ?>
-
<img src="http://bytes.com/submit/304/includes/phpthumb/gallery/entity/<?php echo $entity['logo'];?>&w=100&h=100" border="0" />
-
<?php } else { ?>
-
<img src="admin_image/images.jpeg" border="0" />
-
<?php } ?> </td>
-
<td width="525"><?php echo stripslashes(html_entity_decode($entity['description'])) ;?></td>
-
</tr>
-
<tr>
-
<td colspan="2" style="width:100px; padding-right:10px; text-align:center;"> </td>
-
</tr>
-
<?php //if($entity['map']!='') { ?>
-
<tr>
-
<td colspan="2" style=" border:0px solid #000000; padding-right:10px; text-align:center;">
-
<?php /*?><img src="gallery/entity/<?php echo $entity['map'];?>" border="0" /><?php */?>
-
<?php //for google api
-
$location=explode(',',$entity['location']);
-
$loc=googleCountry($location[0], $location[1], $location[2]);
-
?>
-
<div id="event_map_address"><?php echo $entity['location'] ?></div>
-
<div class="google-map-container" id="event-map" style="width:688px;height:400px;overflow: hidden; border:0;">
-
<?php
-
//$latitude =$loc[2];
-
//$longitude =$loc[3];
-
//include_once("googleMap.html");
-
//include_once("gMap/smallgooglemap.html");
-
?>
-
</div>
-
-
</td>
-
</tr>
-
<?php //} ?>
-
<tr>
-
<td> </td>
-
<td> </td>
-
</tr>
-
<tr>
-
<td style=" font-weight:bold; color:#FBC610; font-family:Verdana, Arial, Helvetica, sans-serif;">Contact Details</td>
-
<td align="left"> </td>
-
</tr>
-
-
<tr>
-
<td>Location :</td>
-
<td align="left"><?php echo $entity['location'];?></td>
-
</tr>
-
-
<tr>
-
<td>Contact Number:</td>
-
<td align="left"><?php echo $entity['contact_no'];?></td>
-
</tr>
-
<tr>
-
<td>E-mail :</td>
-
<td align="left"><a href="mailto:<?php echo $entity['email'];?>"><?php echo $entity['email'];?></a></td>
-
</tr>
-
<tr>
-
<td>Web URL :</td>
-
<td align="left"><a href="<?php echo $entity['url'] ?>" target="_blank"><?php echo $entity['url'];?></a></td>
-
</tr>
-
-
<tr>
-
<td>Opening Hours :</td>
-
<td align="left"><?php echo $entity['time'];?></td>
-
</tr>
-
<tr>
-
<td>Featured in :</td>
-
<td align="left">
-
<table width="100%" border="0" cellspacing="0" cellpadding="0">
-
<tr>
-
<?php echo ($entity['isFeatured']==0)?'':'<td>Category</td>';?>
-
<?php echo ($entity['isFeatured_last']==0)?'':'<td>Last week</td>';?>
-
<?php echo ($entity['isFeatured_new']==0)?'':'<td>New and Noteworthy</td>';?> </tr>
-
</table> </td>
-
</tr>
-
<tr>
-
<td>Price Chart :</td>
-
<td align="left">
-
</tr>
-
<tr>
-
<td colspan="2">
-
<table cellspacing="2" cellpadding="0" border="0">
-
<tr>
-
<?php
-
if($entity_id == 55)
-
{
-
$tablestring ="<table cellspacing='1' cellpadding='2' border='0' style='background-color:#FFFEED; border:2px dashed red;color:black'>
-
<tr>
-
<td style='text-align:center'>
-
<img src='images/benlogo1.gif'>
-
</td>
-
</tr>
-
<tr>
-
<td style='text-align:center'>
-
BUY ONE MEAL AT FULL PRICE GET SECOND MEAL HALF OFF!<br />
-
EAT IN ONLY NO TAKE OUT.
-
</td>
-
</tr>
-
</table><table cellspacing='0' cellpadding='0' border = '0'>
-
<td>
-
<a style='color:#FFFFFF; cursor:pointer' href='couponprint.php'><img src='images/print.gif' />Print this coupon</a>
-
</td>
-
</tr>
-
</table>
-
";
-
$maincontent = $entity['price_chart'].",".$tablestring;
-
} else if($entity_id == 56)
-
{
-
if($entity['price_chart'] != "")
-
{
-
$tablestring = "
-
<tr>
-
<td style='text-align:left'><a href='theresaprint.php?img=buy1get1' target='_blank'><img src='gallery/entity/theresa/Buy1Get1.jpg'></a></td>
-
<td style='text-align:left'><a href='theresaprint.php?img=20offc' target='_blank'><img src='gallery/entity/theresa/20offCoupon.jpg'></a></td>
-
</tr>
-
<tr>
-
<td style='text-align:left'><a href='theresaprint.php?img=5offc' target='_blank'><img src='gallery/entity/theresa/5offCoupon.jpg'></a></td>
-
<td> </td>
-
</tr>
-
";
-
$maincontent = $entity['price_chart'].",".$tablestring;
-
} else {
-
$tablestring = "
-
<table cellspacing='1' cellpadding='2' border='0' >
-
<tr>
-
<td style='text-align:left'><a href='theresaprint.php?img=buy1get1' target='_blank'><img src='gallery/entity/theresa/Buy1Get1.jpg'></a></td>
-
<td style='text-align:left'><a href='theresaprint.php?img=20offc' target='_blank'><img src='gallery/entity/theresa/20offCoupon.jpg'></a></td>
-
</tr>
-
<tr>
-
<td style='text-align:left'><a href='theresaprint.php?img=5offc' target='_blank'><img src='gallery/entity/theresa/5offCoupon.jpg'></a></td>
-
<td> </td>
-
</tr>
-
</table>
-
";
-
$maincontent = $tablestring;
-
}
-
} else {
-
$maincontent = $entity['price_chart'];
-
}
-
$entpicarr = explode(",",$maincontent);
-
$count = 0;
-
for($i=0;$i<sizeof($entpicarr);$i++)
-
{
-
$count = $count+1;
-
?>
-
-
<td >
-
<?php if($entpicarr[$i] !='' && $i != sizeof($entpicarr)-1) { ?>
-
<a href="showmenu.php?entid=<?php echo $entity_id ?>&imgname=<?php echo $entpicarr[$i]?>" target="_blank">
-
<!--<a href="./gallery/entity/<?php echo $entpicarr[$i]?>" target="_blank"> -->
-
<img src="http://bytes.com/submit/304/includes/phpthumb/gallery/entity/<?php echo $entpicarr[$i];?>&w=800&h=400" border="0" /> </a>
-
<?php } elseif ($i == sizeof($entpicarr)-1 && ($entity_id == 55 || $entity_id == 56))
-
{
-
echo $entpicarr[$i];
-
}
-
?> </td>
-
<?php
-
if($count == 2) {
-
echo "</tr><tr>";
-
$count = 0;
-
}
-
}
-
if($count >0)
-
echo "</tr>";
-
?>
-
</table>
-
</td>
-
</tr>
-
<?php
-
/*if(@in_array($entity_id,$array_session))
-
{
-
$rate=$_SESSION['rated'][$entity_id];
-
$clicks=$_SESSION['clicks'][$entity_id];
-
if($clicks=='' || $clicks==0)
-
{ $clicks=1;}
-
$rated_value=$rate/$clicks;
-
$width=$rated_value*100;
-
}
-
else
-
{
-
$rate_em='onmousedown="star.update(event,this)" onmousemove="star.mouse(event,this)"';
-
$width="0";
-
}*/
-
$rate_em='onmousedown="star.update(event,this)" onmousemove="star.mouse(event,this)"';
-
$width="0";
-
-
//check if previous rating exists, if yes then show avg rating
-
$isRated=mysql_query("SELECT * FROM `tbl_rating` WHERE `entityId`='$entity_id'");
-
-
if(mysql_num_rows($isRated)>0)
-
{
-
$rateCheck=mysql_query("SELECT AVG (`value`) as `avgRate` FROM `tbl_rating` WHERE `entityId`='$entity_id'") or die(mysql_error());
-
$avg=mysql_fetch_array($rateCheck);
-
$avg_width=$avg['avgRate']*100;
-
?>
-
<tr><td>Average Rating :</td>
-
<td>
-
<div style="width:100%;"><div style="float:left"></div>
-
<div style="float:left;"> </div>
-
<div id="star" style="display: inline-block; padding-top:4px;">
-
<ul id="star1" class="star" title="Average Rating!" >
-
<li id="starCur1" class="curr" title="5" style="width:<?php echo $avg_width*0.84;?>px;"></li>
-
</ul>
-
<div style="color: rgb(136, 136, 136);display: inline-block;" id="starUser1" class="user" >
-
<?php echo number_format($avg_width,2)."%" ?> </div>
-
</div>
-
</div></td>
-
</tr>
-
<?php
-
}
-
?>
-
<tr>
-
<td >Rate it :</td>
-
<td >
-
<div style="width:100%;"><div style="float:left"></div>
-
<div style="float:left;"> </div>
-
<div id="star" style="display: inline-block; padding-top:4px;">
-
<ul id="star0" class="star" <?=$rate_em?> title="Rate This!" >
-
<li id="starCur0" class="curr" title="5" style="width:<?php echo $width*0.84;?>px;"></li>
-
</ul>
-
<div style="color: rgb(136, 136, 136);display: inline-block;" id="starUser0" class="user" ><?php echo number_format($width,2)."%" ?> </div>
-
<input type="hidden" name="entity" id="entity" value="<?php echo $entity_id;?>">
-
<br style="clear: both;">
-
</div>
-
</div></td>
-
</tr>
-
<?php
-
//check if its entity of restaurant
-
$txtrest=getInformation('tbl_category','catName',$entity['categoryId'], 'id');
-
$pattern='/restaurant|restaurants/i';
-
if(preg_match($pattern, $txtrest)) { ?>
-
<tr><td valign="top">Today's Special :</td><td><?php echo html_entity_decode($entity['today_specials']);?></td></tr>
-
<?php }
-
if($entity['categoryId']==20)
-
{
-
?>
-
<tr>
-
<td colspan="2">Notify me Daily Specials
-
<form id="form1" name="form1" method="post" action="restaurant_subscriber.php?entity=<?php echo $entity_id; ?>" onsubmit="return getemailvalidation()">
-
<input type="text" onclick="resettext()" name="subs_email" id="subs_email" /><input name="submit" type="submit" value="Subscribe" class="button" />
-
<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>
-
</form></td>
-
</tr>
-
<?php
-
}
-
?>
-
<tr><td></td><td style="text-align:right;"><a href="javascript:;" onclick="toggleCommentDiv();">Post Review</a></td></tr>
-
<?php
-
//check if comment exists then show else do nothing
-
$checkComment=mysql_query("SELECT * FROM `tbl_reviews` WHERE `entityId`='$entity_id' ORDER BY `id` DESC");
-
if(mysql_num_rows($checkComment)>0)
-
{ ?>
-
<tr><td colspan="2" style="border-bottom: 1px solid #FBC610;padding:5px 0px;"><span class="yellow-text"><strong>Reviews</strong></span></td></tr>
-
<?php
-
while($comment=mysql_fetch_array($checkComment))
-
{
-
$dateArray=explode(' ',$comment['datetime']);
-
?>
-
<tr><td colspan="2" style="border-bottom:1px solid #999999;">
-
<table width="100%" border="0" cellspacing="0" cellpadding="6" >
-
<tr>
-
<td style="width:100%; padding:3px 0px;"><strong><?php echo $comment['name'];?></strong>
-
says <?php echo "\" ".$comment['review'];?> " <br />
-
on <span class="yellow-text" style="font-weight:normal"><?php echo getDateFormatted($dateArray[0]) ;?></span><br /></td>
-
</tr>
-
</table>
-
</td></tr>
-
<?php
-
}
-
}
-
?>
-
<tr>
-
<td colspan="2" ><div id="commentBox" style="display:none; border-bottom:1px solid #999999;"><?php include_once("commentBox.php")?></div></td>
-
</tr>
-
</table>
| |
Share this Question
| Expert Mod 5K+
P: 6,604
|
what about the error details (line no, …)?
| | |
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.
| | Post your reply Help answer this question
Didn't find the answer to your JavaScript / Ajax / DHTML question?
| | Question stats - viewed: 2407
- replies: 2
- date asked: Aug 26 '09
|