Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Star rating system, vb.net and/or javascript

Posted on 2007-03-25
6
Medium Priority
?
1,254 Views
Last Modified: 2012-06-22
I'm trying to do a rating system like the one that rates movies on blockbuster.com. I'm doing a .net application and want to use the stars as image buttons and when the image button is clicked have some database interactivity happen. My problem is the mousover issue. I'm currently using the .Attributes("onmouseover") to highlight the star that I am on. But let's say someone hovers over the fourth start, I want stars one through four to highlight. How do I make this happen? Do I need a combination of javascript and vb.net? Please help!
0
Comment
Question by:jrmcintosh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 4

Expert Comment

by:Cyber-Drugs
ID: 18788998
After doing a quick google, I found this for you:

http://www.masugadesign.com/the-lab/scripts/unobtrusive-ajax-star-rating-bar/

It is designed for MySQL/PHP, but I'm certain you can just swap the PHP for .NET code.
0
 
LVL 4

Expert Comment

by:Cyber-Drugs
ID: 18789003
0
 

Author Comment

by:jrmcintosh
ID: 18789422
This really isn't exactly what I want but thanks for the links.

To be more specific I have coded basically what I want but want the ability to change multiple imagebutton images based on what imagebutton is hovered over. I don't know if I can do this via .net/javascript or what.
0
Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

 
LVL 4

Accepted Solution

by:
Cyber-Drugs earned 1500 total points
ID: 18789490
Sounds like JavaScript to me, example:


<script>
function showStars(str) {
if (str == 1)
{
getElementById('star_1').src = 'star_on.jpg';
} else if (str == 2)
{
getElementById('star_1').src = 'star_on.jpg';
getElementById('star_2').src = 'star_on.jpg';
}
}

function hideStars(str) {
if (str == 1)
{
getElementById('star_1').src = 'star_off.jpg';
} else if (str == 2)
{
getElementById('star_1').src = 'star_off.jpg';
getElementById('star_2').src = 'star_off.jpg';
}
}
</script>
0
 
LVL 4

Expert Comment

by:Cyber-Drugs
ID: 18789492
onMouseOver=showStars(1)
onMouseOff=hideStars(1)
0
 

Author Comment

by:jrmcintosh
ID: 18789727
I'm not very good with javascript but here is my code, I haven't been able to get it to work. I would also like to do this with <input type=image>'s. Is this possible?

<script>
function showStars(str) {
if (str == 1)
{
getElementById('star_1').src = 'images/lil_boxing_glove.gif';
} else if (str == 2)
{
getElementById('star_1').src = 'images/lil_boxing_glove.gif';
getElementById('star_2').src = 'images/lil_boxing_glove.gif';
}
}

function hideStars(str) {
if (str == 1)
{
getElementById('star_1').src = 'images/no_boxing_glove.gif';
} else if (str == 2)
{
getElementById('star_1').src = 'images/no_boxing_glove.gif';
getElementById('star_2').src = 'images/no_boxing_glove.gif';
}
}
</script>

</head>

<body>

<table border="0" cellpadding="0" cellspacing="0">
 
<tr>  
   <td><img name="star_1" onMouseOut="hideStars(1);" onMouseOver="showStars(1);" src="images/no_boxing_glove.gif" width="20" height="30" border="0">
   </td>
   <td><img name="star_2" onMouseOut="hideStars(2);" onMouseOver="showStars(2);" src="images/no_boxing_glove.gif" width="20" height="30" border="0">
   </td>  
</tr>
</table>

</body>
0

Featured Post

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

721 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