[RESOLVED] Uncaught SyntaxError: Unexpected token ILLEGAL-VBForums
Results 1 to 3 of 3

Thread: [RESOLVED] Uncaught SyntaxError: Unexpected token ILLEGAL

  1. #1

    Thread Starter
    Fanatic Member vuyiswamb's Avatar
    Join Date
    Jan 2007
    Location
    South Africa
    Posts
    793

    Resolved [RESOLVED] Uncaught SyntaxError: Unexpected token ILLEGAL

    Good Day All

    in my page i have a hyperlink button in a gridview defined like this


    Code:
           <a href="#" onclick="<%#  String.Format("return showComment('{0}','{1}')", Replace(Eval("Field1").ToString(),Chr(13),"<BR>"), Replace(Eval("Field2").ToString(),Chr(13),"<BR>") ) %>">
     
                                 <img src="../../Imgs/comment2.png" />
                                 </a>
    and the Function showComment is defined like this



    Code:
            function showComment(CommentPend,CommentCancel) 
            {
                $("#btnclose").unbind();
                $("#divPendComment").center();
                $("#divPendComment").fadeIn('slow');
    
                $("#txtcomment").val(CommentPend.toString().replace(/^[a-z0-9 ]$/i, ''));
    
                $("#txtcommentCancel").val(CommentCancel.toString().replace(/^[a-z0-9 ]$/i, ''));
                 
                $("#btnclose").click(function (e)
                 {
    
                     $("#divPendComment").fadeOut('slow');
                     e.preventDefault();
    
                }); 
                return false;
            }
    now as you can see i am trying to get rid of the special characters like the carriage returns but still i get a a javascript error when this link is clicked

    Uncaught SyntaxError: Unexpected token ILLEGAL

    thanks

  2. #2
    PowerPoster
    Join Date
    May 2002
    Posts
    24,721

    Re: Uncaught SyntaxError: Unexpected token ILLEGAL

    I could be totally off base here... but doesn't the regex expression need to be passed as a string?

    replace(/^[a-z0-9 ]$/i, ''));

    should be

    replace('/^[a-z0-9 ]$/i', ''));

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Fanatic Member vuyiswamb's Avatar
    Join Date
    Jan 2007
    Location
    South Africa
    Posts
    793

    Re: Uncaught SyntaxError: Unexpected token ILLEGAL

    It took longer than expected. so because of time as the data was coming from the DB , i had to clean it from there.

    This issue has been resolved.

    Thanks

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.