Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Feb 2010
    Posts
    208
    Thanks
    15
    Thanked 2 Times in 2 Posts

    ERROR in javaScript

    I have a script:
    PHP Code:
    <script type="text/javascript">
    var 
    gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." "http://www.");
    document.write(unescape("%3Cscript src="" + gaJsHost + "google-analytics.com/ga.js" type="text/javascript"%3E%3C/script%3E"));
    </script>
    <script type="text/javascript">
    try {
    var pageTracker = _gat._getTracker("UA-13289331-1");
    pageTracker._trackPageview();
    } catch(err) {}</script> 
    But firefox detects here an error which is:
    error:
    PHP Code:
    missing after argument list
    [Break 
    on this errordocument.write(unescape("%3Cscript src..."text/javascript"%3E%3C/script%3E"));
    How I can fix that, because I didn't see what is wrong with ) symbol.

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,863
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    Try
    Code:
    document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Regular Coder
    Join Date
    Feb 2010
    Posts
    208
    Thanks
    15
    Thanked 2 Times in 2 Posts
    thanks. The solution was:
    PHP Code:
    document.write(unescape("%3Cscript src=\'" gaJsHost "google-analytics.com/ga.js\' type=\'text/javascript\'%3E%3C/script%3E")); 
    your answer + modification = success

  • #4
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,863
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    Those escaping backslashes are required only when you use two quotes of the same type in a place.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #5
    Regular Coder
    Join Date
    Feb 2010
    Posts
    208
    Thanks
    15
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by abduraooft View Post
    Those escaping backslashes are required only when you use two quotes of the same type in a place.
    Sorry that I didn't wrote all script, because I thought that problem is in javascript.

    All that code was in:

    $variable = 'HERE is javaScript code';

    thanks again for your help


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •