Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By tomsq on
Hello,
Im using Drupal 6.19.In my Drupal page i have the input format set to PHP code.I have included a JS file using the following line of PHP:
print "<script src=\"my_site_includes/js/script.js\"> </script>";
The page is set as the front page and attached to a primary menu item.But the js is not executed when i access the site. However if i edit the page and click save, the js executes. This is really strange, as i have to edit the page and hit save for the js to execute. What could be going wrong here ?.
Please Help
Thank You.
Comments
include in .info
try including the path to your js in your theme's .info file
eg: scripts[] = /js/scripts.js
Thats how it worked for me
Thats how it worked for me, hope it will help you
1. add your ***.js file to theme .info file
scripts[] = ***.js
2. go to template.php of your theme and add
drupal_add_js(drupal_get_path('themes', '/***.js'));
3. write the valid code for js in ***.js file.
for trial to check js working or not replace your code with this and check the alert box coming or not
4. enable javascripts in admin/settings/performance.
5. clear cache every time you change ***.js file