dizzy1 Posted June 30, 2009 Share Posted June 30, 2009 Im making a function where i pass a variable across and i think my syntax is wrong around "+item+". function test(item) { var MinusImage = "<img src='includes/image/Minus.gif' height='25px' width='25px' onclick='HideAnswer("+item+");' />"; } Thanks In Advance DIZZY Link to comment https://forums.phpfreaks.com/topic/164263-solved-javascript-variable/ Share on other sites More sharing options...
rhodesa Posted June 30, 2009 Share Posted June 30, 2009 is item a string? try this: function test(item) { var MinusImage = '<img src="includes/image/Minus.gif" height="25px" width="25px" onclick="HideAnswer(\''+item+'\');" />'; } Link to comment https://forums.phpfreaks.com/topic/164263-solved-javascript-variable/#findComment-866529 Share on other sites More sharing options...
dizzy1 Posted June 30, 2009 Author Share Posted June 30, 2009 Cheers Worked Perfectly :) Link to comment https://forums.phpfreaks.com/topic/164263-solved-javascript-variable/#findComment-866565 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.