MyBB-Plugins Forums

Full Version: Add javascript code to php
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I want to edit the newpoint menu, but instead of adding a normal link to a page I want to add a javascript code that open a widget. Here is the edit I've done
PHP Code:
$menu[0] = '<a href="'.$mybb->settings['bburl'].'/newpoints.php">'.$lang->newpoints_home.'</a>';
if (
$mybb->settings['newpoints_main_statsvisible'] == 1)
    
$menu[1] = '<a href="'.$mybb->settings['bburl'].'/newpoints.php?action=stats">'.$lang->newpoints_statistics.'</a>';
if (
$mybb->settings['newpoints_main_donationsenabled'] == 1)
    
$menu[2] = '<a href="'.$mybb->settings['bburl'].'/newpoints.php?action=donate">'.$lang->newpoints_donate.'</a>';
    
$menu[3] = '<img src="http://yourdomain.com/image.gif" onclick="startGateway('NTUxMTU3');" />'

It seem javascript doesn't work on php pages, any solution?
That's simply the code that is being output to the screen. If the javascript is correct, it will work properly. The last line of code should be:
PHP Code:
$menu[3] = '<img src="http://yourdomain.com/image.gif" onclick="startGateway(\'NTUxMTU3\');" />'