View Single Post
  #5 (permalink)  
Old 09-17-2008, 12:01 PM
mamola500 mamola500 is offline
WebProWorld New Member
 
Join Date: Aug 2008
Posts: 3
mamola500 RepRank 0
Default Re: JavaScript problem

I think my main issue was returning a value from an asp:label (in the example below this is referred to as 'lblzz') which i had assigned with a value of 0 or 1 depending on the type of skin (horizontal or vertical), once i assign this to the test variable and read test.innerHTML i was able to set up the if statement to set the source of my image to either a clear 1px * 1px square (so nothing displays) or an actual image.

I think the way i solved it was a bit of a 'bodge', but it works well enough - so i'm happy. Herte is the code i used if anyone finds it useful and thanks for the replies.

function mouseOver8()
{
setImageOver(;
}
function mouseOut8()
{
setImageOut();
}
function setImageOut()
{
var test = document.getElementById('<%= lblZZ.ClientID %>')

if (test.innerHTML == "0")
{
var img = document.getElementById('<%= bbb.ClientID %>');
img.src = "../images/seperate1px.gif"
}
else if (test.innerHTML == "1")
{
var img = document.getElementById('<%= bbb.ClientID %>');
img.src = "../images/rd_board_text.gif"
}
else
{
var img = document.getElementById('<%= bbb.ClientID %>');
img.src = "../images/seperate1px.gif"
}
}
function setImageOver(a)
{
var test = document.getElementById('<%= lblZZ.ClientID %>')

if (test.innerHTML == "0")
{
var img = document.getElementById('<%= bbb.ClientID %>');
img.src = "../images/seperate1px.gif"
}
else if (test.innerHTML == "1")
{
var result = null;
switch (a)
{

case 1: result = "../images/house.gif"; break;

case 2: result = "../images/strength.gif"; break;

case 3: result = "../images/binoculars.gif"; break;

case 4: result = "../images/graduation.gif"; break;

case 5: result = "../images/bluepeople.gif"; break;

case 6: result = "../images/jobs.gif"; break;

case 7: result = "../images/document.gif"; break;

case 8: result = "../images/keys.gif"; break;

}

var img = document.getElementById('<%= bbb.ClientID %>');
img.src = result;
}
else
{
var img = document.getElementById('<%= bbb.ClientID %>');
img.src = "../images/seperate1px.gif"
}
}
Reply With Quote