Solved

Star rating system, vb.net and/or javascript

Posted on 2007-03-25
6
1,231 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
Is Your DevOps Pipeline Leaking?

Is your CI/CD pipeline a hodge-podge of randomly connected tools? You’ve likely got a tool to fix one problem & then a different tool to fix another, resulting in a cluster of tools with overlapping functionality. Learn how to optimize your pipeline with Gartner's recommendations

 
LVL 4

Accepted Solution

by:
Cyber-Drugs earned 500 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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

Suggested Solutions

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
This article discusses how to implement server side field validation and display customized error messages to the client.
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…

751 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