Jump to content

help, problem with javascript error


Ninjakreborn

Recommended Posts

it won't let me post so I have to do it retardedly this time.

I went over the logic of this code, 4-5 time's at first, because I really had no idea how I was going to achieve this.

http://www.s162063332.onlinehome.us/oakley/property.php?pid=8
On this page, it lists a property based on id, obviously this is property 8.  Now based on this url, it will pull up that property and all images associated with that, but there need's to be a dynamic rollover affect using javascript.  I had no other idea as to how to get it to know which image is which, so I created a function for it.  It's not working though when I roll my mouse over an image and look up firefox's javascript console, it tell's me
[quote]Error: document.bottomimg has no properties
http://www.s162063332.onlinehome.us/oakley/property.php?pid=8
Line: 15[/quote]
It tell's me this everything single time I mouse over.

If anyone can help me figure out what is going on with this I would appreciate it.
Link to comment
Share on other sites

Above was the javascript code, below is what I could get of the image's
It is sort of having problem's letting me post somethign htat is somewhere in my code.
[code]
while  ($image_row = mysql_fetch_array($image_query)) {

$height = "height=\"70px\"";
$width = "";
echo "<a href=\"#\"><img src=\"/oakley/{$image_row[pathtofile]}{$image_row[filename]}\" alt=\"{$image_row[filename]}\" {$height} {$width} name=\"{$image_row[imageid]}\" onmouseover=\"change({$image_row[imageid]})\" /></a>\n";

}
echo "</td></tr></table>";
?>
[/code]
That is where my image's are getting output at.
Link to comment
Share on other sites

Ah, okay, so you're looking to do something like this:
[code]
function change(bottomimg) {
document.all ? document.all["featuredimage"].src = document.all[bottomimg].src : document.featuredimage.src = document[bottomimg].src;
}
[/code]
I'd be surprised if the more experienced people don't have a better or more proper way to do it, but sorry, that is all I have.
Link to comment
Share on other sites

[quote]Ah, okay, so you're looking to do something like this:
Code:

function change(bottomimg) {
document.all ? document.all["featuredimage"].src = document.all[bottomimg].src : document.featuredimage.src = document[bottomimg].src;
}

I'd be surprised if the more experienced people don't have a better or more proper way to do it, but sorry, that is all I have.[/quote]
I don't like using that style, it's all shorthand, and look's very ugly on the eye's.

[quote]Sounds like you're trying to pull info from this DOM object before it's finished loading.[/quote]

I don't activate the rollover until all image's are loaded, and everything is finished loading.
I don't understand why it's not working

Any more advice would be greatly appreciated.
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.