5 Replies - 1421 Views - Last Post: 26 October 2010 - 07:05 AM

#1 winracer   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 141
  • Joined: 02-March 09

help with javascript hover over

Posted 22 October 2010 - 10:31 AM

I have a script that works.

<script type="text/javascript">
var imgs1 = new Array("http://mysite.com/upload/2485.jpg","http://mysite.com/upload/3282.jpg");
var lnks1 = new Array("http://mysite.com/index.pl?session_key=&search_and_display_db_button=on&db_id=2485&query=retrieval","http://mysite.com/index.pl?session_key=&search_and_display_db_button=on&db_id=3282&query=retrieval");
var alt1 = new Array("3 bedroom 1 bath on 3.5 acres $69,000.00 Price Reduced!"," 2 bed/1 bath House 450/mo 350/dep--will do Section 8");
var imgsa = new Array("3 bedroom 1 bath on 3.5 acres \$69,000.00 <font color=#ff0000 size=3><b><i>Price Reduced!</i></b></font>","2 bed/1 bath House 450/mo 350/dep--will do Section 8");

var currentAd1 = 0;
var imgCt1 = 2;
function cycle1() {
  if (currentAd1 == imgCt1) {
    currentAd1 = 0;
  }
var banner1 = document.getElementById('adBanner1');
var banner11 = document.getElementById('adBanner11');
var link1 = document.getElementById('adLink1');
banner1.src=imgs1[currentAd1]
  banner1.alt=alt1[currentAd1]
  document.getElementById('adLink1').href=lnks1[currentAd1]
  document.getElementById('adLinka').innerHTML = imgsa[currentAd1];
currentAd1++;
}
  window.setInterval("cycle1()",5000);
</script>
<b><a style="font-size:16px;color:#000080;font-family:MS SANS SERIF;"" id="adLinka" target="_top">3 bedroom 1 bath on 3.5 acres \$69,000.00 <font color=#ff0000 size=3><b><i>Price Reduced!</i></b></font></a>
</b><br>

<a href="http://mysite.com/index.pl?session_key=&search_and_display_db_button=on&db_id=2485&query=retrieval"" id="adLink1" target="_top">
<img src="http://mysite.com/upload/2485.jpg" id="adBanner1" border="0" width="120" height="90"></a>








i am trying to change so that I have a hover over with photo it works on 1st banner but has same photo on 2nd banner thanks for the help

here is what I have

<script type="text/javascript">
var imgs1 = new Array("http://mysite.com/upload/2485.jpg","http://mysite.com/upload/3282.jpg");
var lnks1 = new Array("http://mysite.com/index.pl?session_key=&search_and_display_db_button=on&db_id=2485&query=retrieval","http://mysite.com/index.pl?session_key=&search_and_display_db_button=on&db_id=3282&query=retrieval");
var alt1 = new Array("3 bedroom 1 bath on 3.5 acres $69,000.00 Price Reduced!"," 2 bed/1 bath House 450/mo 350/dep--will do Section 8");
var imgsa = new Array("3 bedroom 1 bath on 3.5 acres \$69,000.00 <font color=#ff0000 size=3><b><i>Price Reduced!</i></b></font>","2 bed/1 bath House 450/mo 350/dep--will do Section 8");

var currentAd1 = 0;
var imgCt1 = 2;
function cycle1() {
  if (currentAd1 == imgCt1) {
    currentAd1 = 0;
  }
var banner1 = document.getElementById('adBanner1');
var banner11 = document.getElementById('adBanner11');
var link1 = document.getElementById('adLink1');
banner1.src=imgs1[currentAd1]
  banner1.alt=alt1[currentAd1]
  document.getElementById('adLink1').href=lnks1[currentAd1]
  document.getElementById('adLinka').innerHTML = imgsa[currentAd1];
currentAd1++;
}
  window.setInterval("cycle1()",5000);
</script>
<b><a style="font-size:16px;color:#000080;font-family:MS SANS SERIF;"" id="adLinka" target="_top">3 bedroom 1 bath on 3.5 acres \$69,000.00 <font color=#ff0000 size=3><b><i>Price Reduced!</i></b></font></a>
</b><br>

<a href="http://mysite.com/index.pl?session_key=&search_and_display_db_button=on&db_id=2485&query=retrieval" id="adLink1" target="_top" onmouseover="Tip('<img src=&quot;http://mysite.com/upload/2485.jpg&quot; id=&quot;adBanner1&quot; border=&quot;0&quot; width=&quot;120&quot; height=&quot;90&quot;>')" onmouseout="UnTip()" id="adBanner1">
<img src="http://mysite.com/upload/2485.jpg" id="adBanner1" border="0" width="120" height="90"></a>










Is This A Good Question/Topic? 0
  • +

Replies To: help with javascript hover over

#2 winracer   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 141
  • Joined: 02-March 09

Re: help with javascript hover over

Posted 22 October 2010 - 01:24 PM

sorry here is the part of the code I think is giveing me trouble

<a href="http://mysite.com/index.pl?session_key=&search_and_display_db_button=on&db_id=2485&query=retrieval" id="adLink1" target="_top" onmouseover="Tip('<img src=&quot;http://mysite.com/upload/2485.jpg&quot; id=&quot;adBanner1&quot; border=&quot;0&quot; width=&quot;120&quot; height=&quot;90&quot;>')" onmouseout="UnTip()" id="adBanner1">




Was This Post Helpful? 0
  • +
  • -

#3 winracer   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 141
  • Joined: 02-March 09

Re: help with javascript hover over

Posted 23 October 2010 - 07:31 PM

where would i put this to make it chane id="adBanner1" ?
Was This Post Helpful? 0
  • +
  • -

#4 psyking   User is offline

  • D.I.C Head
  • member icon

Reputation: 20
  • View blog
  • Posts: 173
  • Joined: 17-January 10

Re: help with javascript hover over

Posted 23 October 2010 - 09:35 PM

Why not just use:
<img src="image1.imageextension" onmouseover="this.src='image2.imageextension'" onmouseout="this.src='image1.imageextension'" alt="Image alternate Text" />


?
Was This Post Helpful? 0
  • +
  • -

#5 winracer   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 141
  • Joined: 02-March 09

Re: help with javascript hover over

Posted 24 October 2010 - 07:51 AM

thanks I will give it a try. I was just thinking if i had more then two images, i will need something different.
Was This Post Helpful? 0
  • +
  • -

#6 winracer   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 141
  • Joined: 02-March 09

Re: help with javascript hover over

Posted 26 October 2010 - 07:05 AM

no did not work, any thoughts? I need something like

<a href="http://mysite.com/index.pl?session_key=&search_and_display_db_button=on&db_id=2485&query=retrieval" id="adLink1" target="_top" onmouseover="Tip('<img src=&quot;http://mysite.com/upload/2485.jpg&quot; id=&quot;adBanner1&quot; border=&quot;0&quot; width=&quot;120&quot; height=&quot;90&quot;>')" onmouseout="UnTip()" id="adBanner1">


and somehow use the id="adBanner1" to change the photo
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1