How do i write this JavaScript?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • alex79
    Confirmed User
    • Jun 2002
    • 996

    #1

    How do i write this JavaScript?

    i need to rewrite below JS code without "{" and "}"
    PHP Code:
    <script type="text/javascript">
    var aaa = {image:"xxx",width:"400",height:"300" };
    bbb.create(aaa, "yyy");
    </script> 
    
    how i do this?
  • gornyhuy
    Chafed.
    • May 2002
    • 18041

    #2
    Try this:
    var aaa = unescape('&#37;7B') + 'image:"xxx",width:"400",height:"300" ' + unescape('%7D') ;

    icq:159548293

    Comment

    • alex79
      Confirmed User
      • Jun 2002
      • 996

      #3
      Originally posted by gornyhuy
      Try this:
      var aaa = unescape('%7B') + 'image:"xxx",width:"400",height:"300" ' + unescape('%7D') ;
      is not working..
      i receive this error: Expected ";"

      Comment

      • gornyhuy
        Chafed.
        • May 2002
        • 18041

        #4
        Well, if it requires a ; inside the string it would look like this:
        var aaa = unescape('%7B') + 'image:"xxx",width:"400",height:"300" ' + unescape('%7D') + ';' ;

        icq:159548293

        Comment

        • gornyhuy
          Chafed.
          • May 2002
          • 18041

          #5
          This is a good example of why coders don't usually help people in threads when they ask for it.
          Last edited by gornyhuy; 03-12-2007, 04:14 PM. Reason: bad emoticon

          icq:159548293

          Comment

          Working...