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 10 of 10
  1. #1
    New to the CF scene
    Join Date
    Jul 2009
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    javascript error missing ) after argument list

    Hi I'm getting error missing ) after argument list from the below code, please let me know what is wrong with the below code

    function showConform()
    {
    var optLink = "<%=optedLink%>";
    document.getElementById('showConfirm').style.visibility="visible";
    document.getElementById('showConfirm').innerHTML='<a href="#" onclick="javascript:ChagneOptInOut('+optLink+')"><img src="css/i/btn_b_confirm_v1_en.gif"></a>';
    }

  • #2
    Senior Coder ckeyrouz's Avatar
    Join Date
    Jun 2009
    Location
    Montreal, Canada
    Posts
    1,044
    Thanks
    5
    Thanked 179 Times in 179 Posts
    Can you please post here the result of the jsp variable optedLink

  • #3
    New to the CF scene
    Join Date
    Jul 2009
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    result is a string...something like "welcome"

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,918
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    Could it be anything to do with

    ChagneOptInOut



    "Normally the Pakistani police are armed with rifles and atomic weapons". - Political commentator.

  • #5
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    We can not help you until you show us the generated code. View the page source and show us what is generated.

    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #6
    New to the CF scene
    Join Date
    Jul 2009
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ChagneOptInOut() function is working fine, there is no issue with that.

    Below is the source -- where "Click here to Opt-In" is a string value for the javascript variable optLink

    <div id="showConfirm" style="visibility: visible;">
    <a onclick="javascript:ChagneOptInOut(Click here to Opt-In)" href="#">
    <img src="css/i/btn_b_confirm_v1_en.gif"/>
    </a>
    </div>

  • #7
    New to the CF scene
    Join Date
    Jul 2009
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This is code where showConform function will be called


    <a class="superLink" onclick="showConform();" style="cursorointer;"><%if(optedLink != null){ %><%=optedLink %><%}%></a>

  • #8
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    <a onclick="javascript:ChagneOptInOut(Click here to Opt-In)" href="#">

    your problem is there, you do not have a string in the parenthesis, you need some ' around your text.

    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #9
    New to the CF scene
    Join Date
    Jul 2009
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    But i have the quotes here

    document.getElementById('showConfirm').innerHTML='<a href="#" onclick="javascript:ChagneOptInOut('+optLink+')"><img src="css/i/btn_b_confirm_v1_en.gif"></a>';


    is it should be like this??

    ="javascript:ChagneOptInOut(\"optLink\")"><img

  • #10
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    use ' as I suggested.

    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]


  •  

    Posting Permissions

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