jack_wookie
03-09-2012, 06:01 PM
I have a project where I need to be able to control four things onClick. I have a set of 12 arrows (3 colors, 4 directions) and I need to specify the XY coordinate of the arrow tip and I need to call the arrow by color and direction (instead of by src). Is this something that I can do with a 2d array?
My Java looks like this:
function ixycoord(i,x,y) {
document.images["baseimage"].src = i;
if (document.getElementById)
{document.getElementById("baseimage").style.top = y;
document.getElementById("baseimage").style.left = x} else
if (document.layers)
{document.baseimage.top = y; document.baseimage.left = x} else
{document.all.baseimage.style.top = y; document.all.baseimage.style.left = x}
}
And the HTML looks like this:
<div id="baseimage">
<img id="baseimage" src="/arrowred.png">
</div>
<p>This is a the <a href="#n" onClick="ixycoord('whiteup.png',49,57)"> aorta</a>. This is the <a href="#n" onClick="ixycoord('blueleft.png',145,144)"> ventricle </a> and this is the <a href="#n" onClick="ixycoord('redright.png',220,230)">pericardium</a>. </p>
I have to be able to make it *NOT* have the the image source in the onClick. Thanks in advance for any help you can give me!
My Java looks like this:
function ixycoord(i,x,y) {
document.images["baseimage"].src = i;
if (document.getElementById)
{document.getElementById("baseimage").style.top = y;
document.getElementById("baseimage").style.left = x} else
if (document.layers)
{document.baseimage.top = y; document.baseimage.left = x} else
{document.all.baseimage.style.top = y; document.all.baseimage.style.left = x}
}
And the HTML looks like this:
<div id="baseimage">
<img id="baseimage" src="/arrowred.png">
</div>
<p>This is a the <a href="#n" onClick="ixycoord('whiteup.png',49,57)"> aorta</a>. This is the <a href="#n" onClick="ixycoord('blueleft.png',145,144)"> ventricle </a> and this is the <a href="#n" onClick="ixycoord('redright.png',220,230)">pericardium</a>. </p>
I have to be able to make it *NOT* have the the image source in the onClick. Thanks in advance for any help you can give me!