JavaScript OnMouseOver Parse error: syntax error, unexpected T_STRING

When I write this code in <a and >

<a href="'.get_permalink($niphell[post_id]).' " onmouseover="mns('#msnbtn-'.($j+1).'','#msn-'.($j+1).'','.mnsli','.mnsbtbg');">

I got this error

Read More
Parse error: syntax error, unexpected T_STRING in /home/azerinfo/public_html/wp-content/themes/anntheme/scroller.php on line 125

jQuery code:

<script type="text/javascript">
function mns(e,d,c,s){
   jQuery(s).removeClass('aktif');
   jQuery(e).addClass('aktif');
   jQuery(c).css({display: 'none'});
   jQuery(d).css({display: 'block'});
}
mns('#msnbtn-1','#msn-1','.mnsli','.mnsbtbg');
</script>

Update:

<div class="mns">
<div class="crv">

  <style>

.imns{
    background-color: #E8E5E5;
    display: block;
    float: left;
    height: 376px;
    margin-top: 5px;
    padding:10px 0px 10px 10px;
    position: relative;
    width: 600px;
}
.imns .imns_content{
    background-color: #E8E5E5;
    display: block;
    float: left;
    height: 376px;
    position: relative;
    width:400px;
}
.imns .imns_content li{
    background-color: #E8E5E5;
    display: none;
    float: left;
    height: 376px;
    position: relative;
    width:400px;
}
.imns .imns_content li a.hbr{
    background-color: #E8E5E5;
    display: block;
    float: left;
    height: 376px;
    position: relative;
    width:400px;
}
.imns .imns_link{
    background-color: #E8E5E5;
    display: block;
    float: left;
    height: 376px;
    position: relative;
    width: 200px;
}
.imns .imns_link li{
    background-color: #E8E5E5;
    display: block;
    float: left;
    height: 50px;
    position: relative;
    width: 200px;
   padding-bottom:4px;
}
.imns .imns_link li a div.mnsbtbg{
   background:url(http://azerinform.com/wp-content/themes/anntheme/images/mns_numa.jpg) left top;
    display: block;
    height: 50px;
    position: relative;
    width: 196px;
   color:#004072;
   z-index:999999;
   cursor:pointer;
   overflow:hidden;
}
.imns .imns_link li a div.aktif{
   background:url(http://azerinform.com/wp-content/themes/anntheme/images/manset_a.gif) no-repeat left top;
    display: block;
    height: 50px;
    position: absolute;
    width:215px;
   color:#FFFFFF;
   margin-right:6px;
   z-index:999999;
   right:0;
   cursor:pointer;
}
.imns .imns_link li a div.aktif div.mnsbaslik{
   line-height:16px;
   margin-left:15px;
}
.imns .imns_link li a div.mnsbaslik{
   margin:-3px 0 0 3px;
   width:157px;
   line-height:18px;
}
.imns .imns_link li a div.mnsnumara{
   color:#d2d0d1;
}
.tummansetler {
    background: url(http://azerinform.com/wp-content/themes/anntheme/images/tum_mans.png) repeat scroll 0 0 transparent;
    display: block;
    float: left;
    height: 27px;
    width: 400px;
   margin-top:350px;
   position:absolute;
   z-index:999;
}
.mnsustkategori {
    color: #FFFFFF;
    float: left;
    font-weight: bold;
    height: 20px;
    padding-left: 5px;
    padding-top: 12px;
    width: 120px;
}
</style>





<?php
$resim  = mysql_query("SELECT * FROM ".$table_prefix."postmeta LEFT OUTER JOIN ".$table_prefix."posts ON ".$table_prefix."postmeta.post_id = ".$table_prefix."posts.id Where ".$table_prefix."postmeta.meta_key='manset' ORDER By ".$table_prefix."postmeta.post_id DESC Limit 7");
        for ($j=0; $niphell=mysql_fetch_array($resim); $j++){
        $ust .= '<li><a href="'.get_permalink($niphell[post_id]).'" onmouseover="mns('#msnbtn-'.($j+1).'','#msn-'.($j+1).'','.mnsli','.mnsbtbg');">




<div id="msnbtn-'.($j+1).'" onclick="window.location.href='.get_permalink($niphell[post_id]).'" class="mnsbtbg">
            <table height="50" border="0"><tr>
               <td valign="middle"><div class="mnsbaslik font2">'.$niphell[post_title].'</div></td>
               <td valign="middle"><div class="mnsnumara font3">'.($j+1).'</div></td>
            </tr></table>
            </div> </a></li>
            ';


$alt .='<li id="msn-'.($j+1).'" class="mnsli">
            <img  src="'.$niphell[meta_value].'" width="420" height="370"  alt="" />

        </li>
            ';
        }
echo '<!-- WordPress Manset Eklentisi NipHeLL Tarafindan Kodlanmistir bozlak216@gmail.com -->';
?>


<div class="imns">
<div class="imns_content">

<ul>
            <?php echo $alt;?> 

</ul>
</div>


<div class="imns_link"> 


<ul>

            <?php echo $ust;?> 


</ul>
</div>





</div>

<script type="text/javascript">
function mns(e,d,c,s){
   jQuery(s).removeClass('aktif');
   jQuery(e).addClass('aktif');
   jQuery(c).css({display: 'none'});
   jQuery(d).css({display: 'block'});
}
mns('#msnbtn-1','#msn-1','.mnsli','.mnsbtbg');
</script>


</div>

</div>

Related posts

Leave a Reply

1 comment

  1. Your issue is the use of single quotes for JS along with single quotes for PHP. PHP can’t tell that some of the single quotes aren’t intended for it.

    As an example, here:

        $ust .= '<li><a href="'.get_permalink($niphell[post_id]).'" onmouseover="mns('#msnbtn-'.($j+1).'','#msn-'.($j+1).'','.mnsli','.mnsbtbg');">
                P             P                                  P                   J                       
    

    You’ve intended the fourth single quote to be interpreted by JS but PHP is catching it.

    You should probably change to using double quotes in PHP and escaping the double quotes you want in your HTML like this:

        $ust .= "<li><a href="".get_permalink($niphell[post_id])."" onmouseover="mns('#msnbtn-'.($j+1).'','#msn-'.($j+1).'','.mnsli','.mnsbtbg');">
    

    etc.