lulu50
asked on
href is not taking a page
Hi,
I have a menu with button that when user click on it changes from image1 to image2. I am having problem with the href it is not going to an page. I am not sure what I am doing wrong.
here's my code.
I have a menu with button that when user click on it changes from image1 to image2. I am having problem with the href it is not going to an page. I am not sure what I am doing wrong.
here's my code.
<script language="JavaScript" type="text/javascript">
<!--
//clicked images
var clk = new Array("images/BThome2.gif","images/BTMyAcc2.gif","images/BTPostAd2.gif","images/BTSearch2.gif",
"images/BTChat2.gif","images/BTHelp2.gif","images/BTContactUs2.gif");
//original images
var orig = new Array("images/BThome1.gif","images/BTMyAcc1.gif","images/BTPostAd1.gif","images/BTSearch1.gif",
"images/BTChat1.gif","images/BTHelp1.gif","images/BTContactUs1.gif");
function clicked(num) {
document.images["img"+num].src=clk[num];
for (i=0; i<7; i++){
if (i != num) {
document.images["img"+i].src = orig[i];
}
}
}
//-->
</script>
<img href="home.cfm" src="images/BThome1.gif" alt="" border="0" name="img0" onclick="clicked(0);">
<img href="MyAcc.cfm" src="images/BTMyAcc1.gif" alt="" border="0" name="img1"onclick="clicked(1)" >
<img href="PostAd.cfm" src="images/BTPostAd1.gif" alt="" border="0" name="img2"onclick="clicked(2)" >
<img href="Search.cfm" src="images/BTSearch1.gif" alt="" border="0" name="img3"onclick="clicked(3)" >
<img href="Chat.cfm" src="images/BTChat1.gif" alt="" border="0" name="img4"onclick="clicked(4)" >
<img href="Help.cfm" src="images/BTHelp1.gif" alt="" border="0" name="img5"onclick="clicked(5)" >
<img href="contactus.cfm" src="images/BTContactUs1.gif" alt="" border="0" name="img6"onclick="clicked(6)" >
<img> tag doesn't have a href attribute, hence it's ignored. What are you trying to achieve exactly? Clicking on the image should go to that URL or what?
ASKER
yes
Clicking on the image should go to that URL or what?
Clicking on the image should go to that URL or what?
ASKER
yes
Clicking on the image should go to that URL?
Clicking on the image should go to that URL?
ASKER
I have <img href="home.cfm" ??
<img href="home.cfm" src="images/BThome1.gif" alt="" border="0" name="img0" onclick="clicked(0);">
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Can you please, tell me how to fix it?
Do you know why I have spaces?
How can I remove my spaces?
Menu.gif
Do you know why I have spaces?
How can I remove my spaces?
Menu.gif
What css is being applied to that area?
ASKER
Thanks
zvytas is right
replace : <img href="home.cfm" src="images/BThome1.gif" alt="" border="0" name="img0" onclick="clicked(0);">
by : <a href="home.cfm" onclick="clicked(0);"><img src="images/BThome1.gif" alt="" border="0" name="img0" /></a>
and so on
replace : <img href="home.cfm" src="images/BThome1.gif" alt="" border="0" name="img0" onclick="clicked(0);">
by : <a href="home.cfm" onclick="clicked(0);"><img
and so on
lol, sorry I did not refreshed the page :))