...

View Full Version : ) expected



bobz
06-27-2006, 08:29 AM
i am writing string in jsp like below


str = str +
"<a href=\"javascript:setCurrentTreeId('"+this.id+"');" + this.action + "\" id=\"" + this.id + "-anchor\" onfocus=\"\" onblur=\"webFXTreeHandler.blur(this);\" onClick=\"hcl('"+this.action+"');\"" +
(this.target ? " target=\"" + this.target + "\"" : "") +
"title=\"" + tooltip + "\"" +
">" + label + "</a></div>";


its always throwing an javascript error ")" is expected at the onclick function. i don find where i am going wrong. plz suggest me here.
thanks

Mr J
06-27-2006, 09:19 AM
Give this a try


str = str + '<a href="javascript:setCurrentTreeId('+this.id+');" '+ this.action +' id=" ' +this.id +' " anchor="" onfocus="" onblur="webFXTreeHandler.blur(this)" onClick="hcl('+this.action+')" ('+this.target +'? target=" '+this.target+' " :"") title=" '+ tooltip +' "> '+ label +'</a></div>'

bobz
06-27-2006, 12:17 PM
still i am getting the same error!!!!

A1ien51
06-27-2006, 02:25 PM
As I said on the other forum, replace the doble quotes with a single quote (apostrophe) ' so it is easier to read or use a variable that stores a double quote.

Eric

Mr J
06-27-2006, 02:55 PM
Give my previous post another try

bobz
06-28-2006, 05:28 AM
whenever i do the replace of ' with " and viceversa , its giving me same error. these lines of code are present in js file inside string variable. anymore suggestions? orelse is it the behaviour of IE version 6 for the use of ' in the code. there is no negative effort on my functionality. its working very fine though its throwing an ) expected exception.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum