#1
  1. No Profile Picture
    Contributing User
    ASP Explorer (0 - 99 posts)

    Join Date
    May 2009
    Posts
    30
    Rep Power
    30

    [javascript] 'double' double quotes in javascript usage?


    Hi good js peops --

    Ive come across some js code im trying to deconstruct and have found some double 'double quotes' strings and cant find reference to how they work.

    Examples snips (note the dual sets of doubled double quotes):
    1. if (typeof(iVar) == ""function"")

    2. alert(""no such element"");

    3. var x = obj.getElementsByTagName(""form"");

    FYI these originated from "unpacking" some packed js code using the dean edwards js packer --> http://dean.edwards.name/packer/

    Anyone shed some light, links or ref docs on why the double sets of double quotes are there??? Being a js noob, im rather stumped by them.

    tnx all.
  2. #2
  3. Moderator From Beyond
    ASP Mastermind (5000+ posts)

    Join Date
    Sep 2004
    Location
    Israel
    Posts
    31,135
    Rep Power
    2925
    JS got no double quotes, unlike VBScript such thing has no special meaning.
    the code you posted will give syntax error as far as I can see, just get rid
    of the double quotes (and have one only) to fix this.
  4. #3
  5. ASP Hero (2000 - 2499 posts)

    Join Date
    Jun 2006
    Location
    New Springfield, OH
    Posts
    2,045
    Rep Power
    1055
    It's also possible that the strings were stripped and originally had escape characters.

    "\"some string\""

    This is used to include double quotes in a string.
    Don't like me? Click it.

    Scripting problems? Windows questions? Ask the Windows Guru!

    Stay up to date with all of my latest content. Follow me on Twitter!

    Help us help you! Post your exact error message with these easy tips!!
  6. #4
  7. No Profile Picture
    Contributing User
    ASP Explorer (0 - 99 posts)

    Join Date
    May 2009
    Posts
    30
    Rep Power
    30
    Originally Posted by Nilpo
    It's also possible that the strings were stripped and originally had escape characters.

    "\"some string\""

    This is used to include double quotes in a string.
    could well be.

    here's an excerpt of some of the packed source before decoding with the 'unpacker'. ( note it also has the double double quotes that end up in the decoded code snips from above):

    Code:
    eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?....
    ....{snip lots and lots of code between start above, and code below showing double quotes}....

    Code:
    ...{7 y=6.y.2b();3(y==""2Q""||6.G){3(6.G){6=6.G}7 1P=(6.Q.2b())==""2c"";7 T="""";.....
    ...{lots more code to end}


    so the double quotes exist in the orig AND the decoded samples if that makes any difference.

    Anyone have experience with dean edwards packer and if it inserts double quotes when initially encoded? I can't seem to make the double double quot's happen from noodling around with it for 30 mins or so.


    tnx for replies, so far, btw.

    d
  8. #5
  9. No Profile Picture
    Contributing User
    ASP Explorer (0 - 99 posts)

    Join Date
    May 2009
    Posts
    30
    Rep Power
    30
    And the answer is.....


    .....the double quoted fragments I found were because the js functions had been assigned to a string var.

    i.e.

    var x = " (bunch of js double double quotes inside here as a release for the outter quotes. y==""2Q"") "

    But that var assignment was not part of the snippet shown. DOH!

    Im not sure anyone will have such a question, but there is the followup answer if they do.

Similar Threads

  1. finding double quotes in a string
    By yogaboy in forum .NET Development
    Replies: 4
    Last Post: November 13th, 2005, 10:13 AM
  2. how to include double quotes in double quotes
    By mramardeepsingh in forum ASP Development
    Replies: 9
    Last Post: August 5th, 2005, 03:44 PM
  3. Replies: 4
    Last Post: December 9th, 2004, 05:33 PM
  4. Role Of Double Quotes and Single Quotes
    By Steve Schofield in forum ASP Development
    Replies: 1
    Last Post: May 21st, 2001, 12:13 PM
  5. Role Of Double Quotes and Single Quotes
    By Steve Schofield in forum ASP Development
    Replies: 0
    Last Post: May 20th, 2001, 04:47 AM

IMN logo majestic logo threadwatch logo seochat tools logo