How to write two ampersand for JavaScript in WordPress?

I use WordPress 3.0.1 and install Exec-PHP plugin. I edit the code in admin panel- pages – html cede. I want to add some JavaScript in a custom page.

When the code use two ampersand, it occupy wrong. && become && How to solve this problem?

for(i=0;i<3;i++)
{
   var l=a.length;
   //alert(l);
   var iNum=parseInt(Math.random()*l);
   //alert(iNum);

   b[i]=a[iNum];
   if(iNum==0&amp;&amp;iNum+1!=l){a.shift();}else if(iNum+1==l){a.pop()}else{a.splice(iNum,1)}
   //alert(b[i]);
   document.write(b[i]);
}

Related posts

Leave a Reply

3 comments

  1. Are you passing a script in through the content area? Why is this being parsed and escaped by WordPress?

    If you are passing it into the content area, WordPress is escaping those characters. Otherwise, people could use SQL injection to inject a XSS onto your page (e.g. running some Javascript on https://malicious.site/whatever.js).

    This might not work, but try just switching to Text rather than Visual in the editor. I think that might be the issue. If you switch to Text, I bet you will see the coded ampersands in the HTML.