Jump to content

[SOLVED] Strange Syntax Error


Ninjakreborn

Recommended Posts

function open_window(artist, title) {
    window.open("buy_pages/"+artist+"_"+title+".php", "newwin");          
}			

$('#changing_content').html($('#changing_content').html()+'<center><a onClick="open_window("'+artist+'", "'+title+'");" href="#"><img src="image/buybutton.gif" style="border: none;" /></a><br /><br /><b>'+json.title+'</b></center>');

This should  not be throwing a syntax error.  This should be simply setting a function onclick for the link and then calling a function when it's clicked.

Link to comment
Share on other sites

without all the code, it's kind of hard to debug it. but my guess is it should be:

$('#changing_content').html($('#changing_content').html()+'<center><a onClick="open_window(\''+artist+'\', \''+title+'\');" href="#"><img src="image/buybutton.gif" style="border: none;" /></a><br /><br /><b>'+json.title+'</b></center>');

also, should json.title just be title?

Link to comment
Share on other sites

Perfect a mixture of those two solutions work. And no the json.title is one variable and title is another variable. json.title was the original variable and has it's uses but I needed some slight changes for the links so I put them in title instead.

 

Thanks for the help.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.