I need to execute a insert and execute javaScript in the following way:

```
$("body").append("<script>//Some Code</script>");

```

I have tried following two encoding methods

1. Manually move everything to the same line and replace all double quotes with single quotes using search and replace

```
Fiddle:http://jsfiddle.net/benPearce/vaxo00eb/

```
2. String escape the javaScript using [stringescape\_tool](http://www.htmlescape.net/stringescape_tool.html)

Both of these methods result in "Unexpected string" syntax errors. If anyone can help me out I'd be greatly appreciative!

The Script I need to inject

```
  seal_gif_url="images/nortonseal.gif";

  dn="www.mysite.com";
  sap="getnortonsealimage.js";
  splash_url="https://trustsealinfo.verisign.com";
  tpt="transparent";

  language="en";
  u1=splash_url+"/splash?form_file=fdf/splash.fdf&dn="+dn+"&lang="+language;

  function vrsn_splash() {
    tbar = "location=yes,status=yes,resizable=yes,scrollbars=yes,width=560,height=500";
    sw = window.open(u1,'VRSN_Splash',tbar);
    sw.focus();
  }

  {
    var ver=-1;
    var v_ua=navigator.userAgent.toLowerCase();
    var re=new RegExp("msie ([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(v_ua) != null)
     ver = parseFloat( RegExp.$1 );
    var v_old_ie=(v_ua.indexOf("msie")!=-1);
    if (v_old_ie) {
     v_old_ie = ver < 5;
    }

    function maction(e){
      if (document.addEventListener) {
        var seal=(e.target.name=="seal");
        if (seal) { vrsn_splash(); return false; }
      } else if(document.captureEvents) {
        var tgt=e.target.toString(); 
        var seal=(tgt.indexOf("splash")!=-1);
        if (seal){ vrsn_splash(); return false; }
      }
      return true;
    }

    function mouseDown() {
      if (event.button==1){
        if (v_old_ie) { return true; } else { vrsn_splash(); return false; }
      } else if (event.button==2) { vrsn_splash(); return false; }
    }

    document.write("<a HREF=\""+u1+"\" tabindex=\"-1\" onmousedown=\"return mouseDown();\" target=\"VRSN_Splash\"><IMG NAME=\"seal\" BORDER=\"true\" SRC=\""+seal_gif_url+"\" oncontextmenu=\"return false;\"></A>");

    if((v_ua.indexOf("msie")!=-1) && (ver>=7)) {
      var plat=-1;
      var re=new RegExp("windows nt ([0-9]{1,}[\.0-9]{0,})");
      if (re.exec(v_ua) != null)
        plat = parseFloat( RegExp.$1 );

      if (plat >= 5.1) {
       document.write("<div style='display:none'>");
       document.write("<img src='https://extended-validation-ssl.verisign.com/dot_clear.gif'/>");
       document.write("</div>");
      }
    }

    if (document.addEventListener){ 
      document.addEventListener('mouseup', maction, true); 
    } else {
      if (document.layers){
        document.captureEvents(Event.MOUSEDOWN); document.onmousedown=maction;
      }
    }

    function resized(){
      if(pageWidth!=innerWidth || pageHeight!=innerHeight){
        self.history.go(0);
      }
    }

    if(document.layers){
      pageWidth=innerWidth; pageHeight=innerHeight; window.onresize=resized;
    }
  }

```