Jump to content

[SOLVED] Extremely strange bug, please check this out.


B0b

Recommended Posts

Hi,

 

I'm begining in Javascript and I'm writing a simple website, something looking like a "skill" calculator for a PC game.

I'm stuck in a bug (after 1000 some lines) and I really don't know what's the problem, please advise me...

 

I got a couple of images that have onmouseover, onmouseout and onclick events.

I want them to work just like a star rating system, but a bit more complex.

 

So right now I'm stuck on the onmouseover.

There's 3 types of images I got (selected (when it has been clicked), unselected (when it hasn't been onmouseover or clicked) and onmouseover (when it obviously has been mouseovered and not "mouseoutted").

 

I want the image to change OnMouseOver only it is not allready the "selected" image (if it hasn't been clicked).

Here's the code:

 

function do_pip_mouseover(pip)
{
switch (parseInt(pip))
{
	case 1:
	{
		document.getElementById(pip.substring(1) + "_score").innerHTML = "WTFFFFFFFFFFFF3453453453454";
		if (document.getElementById("derbaran1").src == "/pip_unselected.png")
		{
			document.getElementById(pip.substring(1) + "_score").innerHTML = "WTFFFFFFFFFFFF";
			document.getElementById("derbaran1").src = "/pip_mouseover.png";
		}
		break;
                   ...

 

Ok so, in this, "pip" will return either "1derbaran", "2derbaran", "3derbaran" (up to 8 ) depending on the image clicked.

So I'm doing a parseInt to know which one and I do a "switch" with this. Until then it work all good. If I mouse over the first, it will change the innerHTML to that "WTFFFFFFFFFFFF3453453453454" text (it was to test) BUT it will not do the rest (it won't change to the second text and change image). I mean the condition "if" after is false, but it should be true as the image I mouseover is this exact same URL (yes the folder and everything is good, I'm 100% sure and yes the element IS is "derbaran1"), the image of the first pip I mouseover is unselected.

 

What's wrong? I have NO clues.

 

Any ideas? Thanks.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.