Ninjakreborn Posted November 6, 2006 Share Posted November 6, 2006 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=8On 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=8Line: 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. Quote Link to comment Share on other sites More sharing options...
Ninjakreborn Posted November 6, 2006 Author Share Posted November 6, 2006 [code]<script type="text/javascript">function change(bottomimg) {document.featuredimage.src = document.bottomimg.src}</script>[/code] Quote Link to comment Share on other sites More sharing options...
Ninjakreborn Posted November 6, 2006 Author Share Posted November 6, 2006 Above was the javascript code, below is what I could get of the image'sIt 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. Quote Link to comment Share on other sites More sharing options...
Telemachus Posted November 6, 2006 Share Posted November 6, 2006 What I notice is that you're passing bottomimg to the function but then using document.bottomimg. Quote Link to comment Share on other sites More sharing options...
Ninjakreborn Posted November 6, 2006 Author Share Posted November 6, 2006 bottomimg is suppose to simply be the name of the image.Through the function I pass bottomimg as the variable name, it's suppose to replace that with the number or value I insert in there, but if that's not working then I am confused. Quote Link to comment Share on other sites More sharing options...
Telemachus Posted November 7, 2006 Share Posted November 7, 2006 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. Quote Link to comment Share on other sites More sharing options...
fenway Posted November 7, 2006 Share Posted November 7, 2006 Sounds like you're trying to pull info from this DOM object before it's finished loading. Quote Link to comment Share on other sites More sharing options...
Ninjakreborn Posted November 7, 2006 Author Share Posted November 7, 2006 [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 workingAny more advice would be greatly appreciated. Quote Link to comment Share on other sites More sharing options...
fenway Posted November 7, 2006 Share Posted November 7, 2006 Well, you're not pulling bottomimg from the DOM properly -- use getElementByID(), and then check to make sure you get a valid object first, since this is clearly the issue. Quote Link to comment Share on other sites More sharing options...
Ninjakreborn Posted November 8, 2006 Author Share Posted November 8, 2006 I will try that tomorrow, and see if it works thanks. Quote Link to comment Share on other sites More sharing options...
Ninjakreborn Posted November 8, 2006 Author Share Posted November 8, 2006 Thanks fenway, I went ahead and set the function to still recieve the id, but instead it replaces the getElementById(bottomimg)then I pass the value as the id, then it works perfectly now, thanks for all the help. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.