It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

having code issues

having code issues

Postby daemonzul on Sat Jan 16, 2010 6:48 pm

I am working with a script for doing a basic rollover effect by switching out one image with another and then reverting back using onMouseOver and onMouseOut commands in javascript. What I would like to do is have two images switch out at two different locations. Basically as they rollover the button it will give a description in the center of the info pertaining to the button. I was able to get the rollover to work but for some reason I am not doing the second part properly to have the text appear in the description area. Could someone please help with a bit of advise as to what I could try here to get it to work. I thought if I set a different variable for the other image I would be able to use if statements to get it to change based on the state of the button. Im obviously not advanced at all. Im trying to learn more but hitting walls like this is frustrating and I am sure there is a way to make this work. Its most likely a syntax issue or something. Any help would be appreciated. here is what I have so far...the first part is the origional code that works for creating the rollover effect...no problem there...the second part is my changes which stops the rollover effect and created errors on the page.

I tried posting code here but for some reason it wont let me. Should I just attach as a .txt doc?

hope this is enough for some good suggestions. Im a newb but can understand what the code does. I just have no previous formal training. Im a work in progress.

Thanks!!
daemonzul
100+ Club
 
Posts: 106
Joined: Fri Jan 15, 2010 8:21 pm

Re: having code issues

Postby daemonzul on Sat Jan 16, 2010 6:50 pm

looks like you can only post a link to the source code here....is that correct?

because the problem with that is the code is only accessible to members which need to be approved...lol
daemonzul
100+ Club
 
Posts: 106
Joined: Fri Jan 15, 2010 8:21 pm

Re: having code issues

Postby daemonzul on Sat Jan 16, 2010 8:12 pm

ok...here is the code in the attachment. Im getting an error num value not set oon the page when I test it on line 38. Guess I am missing something...Ill keep working on it.
daemonzul
100+ Club
 
Posts: 106
Joined: Fri Jan 15, 2010 8:21 pm

Re: having code issues

Postby daemonzul on Sat Jan 16, 2010 8:23 pm

not sure if it attached the last time...trying again here
so you pretty much cant post code on here up send any attachments with code in it...soooo....I will send a screenshot of the code as a gif file...perhaps that will work.

[attachment=0]help.gif[/attachment]


That worked...this is the area with the problem...lol

Any suggestions would be wonderful and thank you for taking your time with this...very much appreciated. I hope to be in your shoes one day helping some other poor chap work it out.
You do not have the required permissions to view the files attached to this post.
daemonzul
100+ Club
 
Posts: 106
Joined: Fri Jan 15, 2010 8:21 pm

Re: having code issues

Postby harrierdh on Mon Jan 18, 2010 3:32 pm

daemonzul,
If you are still having problems post your code using the Code tab above. That way someone could paste your code into an editor and try to help you. The image attachment shows the code, but I don't think anyone is going to type in all that code and try it out.
harrierdh
50+ Club
 
Posts: 51
Joined: Wed Dec 16, 2009 7:04 pm

Re: having code issues

Postby daemonzul on Mon Jan 18, 2010 5:25 pm

Thanks for responding to this issue. I am having a problem using the "code" tag here for some reason. Whenever I put my code in there it says method not implemented. I dont know why...so then I try and add it to a .txt file and I cant upload it. This is frustrating to say the least. I would be happy to e-mail it to someone if they would like to give it a look. Any suggestions as to why i cant just post it here let me know. Im using chrome. Let me just try IE real quick
daemonzul
100+ Club
 
Posts: 106
Joined: Fri Jan 15, 2010 8:21 pm

Re: having code issues

Postby daemonzul on Mon Jan 18, 2010 5:27 pm

Code: Select all
var revert = new Array();
var inames = new Array('anim','office','carpet','paving','IT','plumb','elect','prop','fence','estate','general','roof','heat','sewer','land','street');


if (document.images) {
  var flipped = new Array();
  for(i=0; i< inames.length; i++) {
    flipped[i] = new Image();
    flipped[i].src = "images/"+inames[i]+"_ovr.jpg";
  }
}

function over(num) {
  if(document.images) {
    revert[num] = document.images[inames[num]].src;
    document.images[inames[num]].src = flipped[num].src;
  }
}
function out(num) {
  if(document.images) document.images[inames[num]].src = revert[num];
}


a href="animal.php" img src="images/anim.jpg" name="anim" onMouseOver="over(0)" onMouseOut="out(0)" width="188" height="26" border="0" alt=""
      img src="images/Vendor_05.jpg" width="625" height="443" alt=""
      td rowspan="6"


I basically removed the code I tried earlier due to the fact it was not working. I wanted to set a new variable to link to the img src "images/vendor_o5. What Id like to do is have the onMouseOver also change the vendor_05 out so text that describes the rollover button would appear there. Originally I just wanted to put text out there rather than use the space and load time for the image swap. Id rather do that but just getting this to work would be fine also. Thanks
Last edited by daemonzul on Mon Jan 18, 2010 10:34 pm, edited 1 time in total.
daemonzul
100+ Club
 
Posts: 106
Joined: Fri Jan 15, 2010 8:21 pm

Re: having code issues

Postby harrierdh on Mon Jan 18, 2010 7:24 pm

First strip off your html /html tags. Then it should work. The browser is treating your /html tag as a real tag.
harrierdh
50+ Club
 
Posts: 51
Joined: Wed Dec 16, 2009 7:04 pm

Re: having code issues

Postby daemonzul on Mon Jan 18, 2010 10:35 pm

Duh, Thanks for the smack in the face.. As you can see I rarely use message boards...lol
daemonzul
100+ Club
 
Posts: 106
Joined: Fri Jan 15, 2010 8:21 pm


Who is online

Users browsing this forum: No registered users and 5 guests