Link to home
Start Free TrialLog in
Avatar of Alpha_AI
Alpha_AI

asked on

The javascript function does not load

Hello,

This javascript function does not load?

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

</script>

<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?

Ben
Avatar of deresh
deresh

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')">
Avatar of Alpha_AI

ASKER

no the ajax.js file is in the include folder (which is a child folder)
SOLUTION
Avatar of Vel Eous
Vel Eous

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Neither works

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

javascript:getRating('20','article_rating')

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

Ben
Are you just looking to change the color scheme of your site when a button/link is clicked ?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial