Click to See Complete Forum and Search --> : [RESOLVED] why am I getting "missing ) after argument list"?
stevemtno
07-29-2008, 10:14 AM
Firebug is giving me a "missing ) after argument list" error on this line:
<a href="javascript:void(0);" onclick="void(window.open('http://www.facebook.com/sharer.php?u='http://www.stltoday.com?referrer=facebook'+'&t='','sharer','toolbar=no,width=642,height=436'));" class="sharelink_story">Facebook</a>
Looks fine to me. Here's the URL where it's being used:
http://preview.stltoday.com/stltoday/news/storiessm.nsf/story/5CEBD5F38FCBEC3486257491004F0786?OpenDocument
If anyone can help, I'd really appreciate it... thanks!
Steve
correct and standard should be
<a href="#" onclick="window.open('http://www.facebook.com/sharer.php?u='http://www.stltoday.com?referrer=facebook'+'&t='','sharer','toolbar=no,width=642,height=436');return false" class="sharelink_story">Facebook</a>
stevemtno
07-29-2008, 10:34 AM
Sorry about that. Should've used the code tag.
The code was wrong anyway (thanks, Lotus Notes)
Here's the real code:
<a href="javascript:void(0);" onclick="void(window.open('http://www.facebook.com/sharer.php?u='http://www.stltoday.com/stltoday/news/storiessm.nsf/story/5CEBD5F38FCBEC3486257491004F0786?OpenDocument?referrer=facebook'+'&t='Preserving digital memories can be a pain','sharer','toolbar=no,width=642,height=436'));" class="sharelink_story">Facebook</a>
Should I not use the javascript:void() ?
Declan1991
07-29-2008, 10:45 AM
You shouldn't have javascript in the href because if JavaScript is disabled, you cannot follow the link. And the void in the onclick is just pointless.<a href="http://www.facebook.com/sharer.php?u=http://www.stltoday.com/stltoday/news/storiessm.nsf/story/5CEBD5F38FCBEC3486257491004F0786?OpenDocument?referrer=facebook&t=Preserving digital memories can be a pain" onclick="window.open(this.href,'sharer','toolbar=no,width=642,height=436');return false" class="sharelink_story">Facebook</a>
Would you post the actual URL you are trying to get to (no HTML, no JavaScript, just the URL)? There are two "?" in the one you have which is impossible as far as I can remember because it is a reserved character (for GET variables).
stevemtno
07-29-2008, 11:02 AM
You shouldn't have javascript in the href because if JavaScript is disabled, you cannot follow the link. And the void in the onclick is just pointless.<a href="http://www.facebook.com/sharer.php?u=http://www.stltoday.com/stltoday/news/storiessm.nsf/story/5CEBD5F38FCBEC3486257491004F0786?OpenDocument?referrer=facebook&t=Preserving digital memories can be a pain" onclick="window.open(this.href,'sharer','toolbar=no,width=642,height=436');return false" class="sharelink_story">Facebook</a>
Would you post the actual URL you are trying to get to (no HTML, no JavaScript, just the URL)? There are two "?" in the one you have which is impossible as far as I can remember because it is a reserved character (for GET variables).
Declan,
Check the code below. It's different from what you have in your reply for some reason. I think the quotes are balanced properly.
<a href="javascript:void(0);" onclick="void(window.open('http://www.facebook.com/sharer.php?u='http://www.stltoday.com/stltoday/news/storiessm.nsf/story/5CEBD5F38FCBEC3486257491004F0786?OpenDocument?referrer=facebook'+'&t='Preserving digital memories can be a pain','sharer','toolbar=no,width=642,height=436'));" class="sharelink_story">Facebook</a>
The line above is from the following page:
http://preview.stltoday.com/stltoday/news/storiessm.nsf/story/5CEBD5F38FCBEC3486257491004F0786?OpenDocument
Click on the Share This link at the top of the story and you'll see a link for Facebook (this is the link that goes with the code pasted above). The idea is to let people share the link with others on Facebook.com.
Hope that helps explain things better..
Thanks for your help,
Steve
Declan1991
07-29-2008, 11:16 AM
The quotes for sure are wrong, window.open('http://www.facebook.com/sharer.php?u='httpThe second quote finishes the string, and that's what is causing your error.
I didn't think that was a proper URL, but I don't have a FaceBook account to check. If it is, you can use this:<a href="http://www.facebook.com/sharer.php?u='http://www.stltoday.com/stltoday/news/storiessm.nsf/story/5CEBD5F38FCBEC3486257491004F0786?OpenDocument?referrer=facebook'+'&t='Preserving digital memories can be a pain'" onclick="window.open(this.href,'sharer','toolbar=no,width=642,height=436');return false" class="sharelink_story">Facebook</a>
stevemtno
07-30-2008, 11:06 AM
Hi Declan,
Your code worked great. As it turns out tho, there are some other issues with the Share This links on our side (actually, on their side - things changed, documentation didn't, etc) that need to be addressed.
Thanks for all your help,
Steve