The javascript function does not load

Posted on 2007-03-26
Medium Priority
Last Modified: 2010-07-27

This javascript function does not load?

<script language="javascript" src="ajax.js">


<td align="center" onMouseOver="this.className='cell_over';" onMouseOut="this.className='cell_out';" bgcolor="#FFFFCC"><a href="javascript:getRating('<?=$rows_articles['articles_id']?>','article_rating')" class="narmal_nav">Vote!</a></td>

When you mouseover on a td, the td changes color and when i click on the hyperlink which is inside the td cell, it is supposed to load a javascript function which is sitting in my ajax.js file
Article_ID is the number of the article and the article_rating is div that i am wishing to replace.

I think i have my syntax wrong somewhere. If i have, can someone give me some pointers to follow?

Question by:Alpha_AI
  • 2
  • 2
  • 2

Expert Comment

ID: 18791385
is ajax.js in the same folder as your php script?

otherwise it should work. you could write A tag differently as:

<a href="#" onclick="javascript:getRating('<?=$rows_articles['articles_id']?>','article_rating')">

Author Comment

ID: 18791396
no the ajax.js file is in the include folder (which is a child folder)
LVL 14

Assisted Solution

by:Vel Eous
Vel Eous earned 186 total points
ID: 18791482
You will need to reference that folder then in the JavaScript src.


<script language="javascript" src="childFolder/ajax.js">
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!


Author Comment

ID: 18791493
Neither works

When i look in the bottom hand corner of my browser the hint is there and it says


the 20 is the article id so should it be an integer instead of typecasted as a string?

LVL 14

Expert Comment

by:Vel Eous
ID: 18791559
Are you just looking to change the color scheme of your site when a button/link is clicked ?

Accepted Solution

deresh earned 189 total points
ID: 18791609
try removing single quotation mark from your javascript call like:


Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
AngularJS web development a very simple procedure. So, to put it, in short, AngularJS’ stand out features are – Two-way data binding, MVC structure, directives, templates, dependency injections and testing.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question