Results 1 to 2 of 2

Thread: What is in this function call?

Hybrid View

  1. #1
    Join Date
    Sep 2008

    Exclamation What is in this function call?

    I have a function called InsertSmiley. It inserts an image into a text editor. I got all the source code for this from FCKeditor. I am going to be playing around a little with the call of this function and just want to understand the syntax here.

    Could someone explain to me what this call is doing? Particularly after the pUrl.replace.

    onclick="InsertSmiley(\'' + pUrl.replace(/'/g, "\\'" ) + '\')"

  2. #2
    Join Date
    Sep 2008
    It is replacing a ' with \' globally. (g = globally)

    That is usually done when a page is going to be stored into a database so it doesn't break the code.


    var str = "This is a 'test' string";
    str.replace(/'/g, "\\'");
    window.alert(str) // alerts: This is a \'test\' string

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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

Recent Articles