...

View Full Version : javascript error missing ) after argument list



nandeesh_su
07-18-2009, 12:34 AM
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>';
}

ckeyrouz
07-18-2009, 02:42 AM
Can you please post here the result of the jsp variable optedLink

nandeesh_su
07-18-2009, 04:40 AM
result is a string...something like "welcome"

Philip M
07-18-2009, 09:32 AM
Could it be anything to do with

ChagneOptInOut



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

A1ien51
07-18-2009, 01:39 PM
We can not help you until you show us the generated code. View the page source and show us what is generated.

Eric

nandeesh_su
07-18-2009, 09:58 PM
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>

nandeesh_su
07-18-2009, 10:02 PM
This is code where showConform function will be called


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

A1ien51
07-18-2009, 10:05 PM
<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

nandeesh_su
07-18-2009, 10:40 PM
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

A1ien51
07-18-2009, 11:28 PM
use ' as I suggested.

Eric



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum