Inoob
12-15-2006, 09:04 AM
firstly this is what I have..
<script type="text/javascript">
function mouseOver(txt)
{
if (txt == "b1")
document.b1.src ="images/rollbutton.gif"
if (txt == "b2")
document.b2.src ="images/rollbutton.gif"
if (txt == "b3")
document.b3.src ="images/rollbutton.gif"
if (txt == "b4")
document.b4.src ="images/rollbutton.gif"
if (txt == "b5")
document.b5.src ="images/rollbutton.gif"
if (txt == "b6")
document.b6.src ="images/rollbutton.gif"
if (txt == "b7")
document.b7.src ="images/rollbutton.gif"
if (txt == "b8")
document.b8.src ="images/rollbutton.gif"
if (txt == "b9")
document.b9.src ="images/rollbutton.gif"
if (txt == "b10")
document.b10.src ="images/rollbutton.gif"
}
function mouseOut(txt)
{
if (txt == "b1")
document.b1.src ="images/b1.PNG"
if (txt == "b2")
document.b2.src ="images/b2.PNG"
if (txt == "b3")
document.b3.src ="images/b3.PNG"
if (txt == "b4")
document.b4.src ="images/b4.PNG"
if (txt == "b5")
document.b5.src ="images/b5.PNG"
if (txt == "b6")
document.b6.src ="images/b6.PNG"
if (txt == "b7")
document.b7.src ="images/b7.PNG"
if (txt == "b8")
document.b8.src ="images/b8.PNG"
if (txt == "b9")
document.b9.src ="images/b9.PNG"
if (txt == "b10")
document.b10.src ="images/b10.PNG"
}
</script>
what I am trying to make it is...
function mouseOver(txt) document.+txt+.src ="images/"+txt+".PNG"
function mouseOut(txt) document.+txt+.src ="images/rollbutton.gif"
I mean you see what I want just I have no idea how to pull it off, I just want it to do it by itself to eliminate redundancy, redundancy hurts my eyes :(
<script type="text/javascript">
function mouseOver(txt)
{
if (txt == "b1")
document.b1.src ="images/rollbutton.gif"
if (txt == "b2")
document.b2.src ="images/rollbutton.gif"
if (txt == "b3")
document.b3.src ="images/rollbutton.gif"
if (txt == "b4")
document.b4.src ="images/rollbutton.gif"
if (txt == "b5")
document.b5.src ="images/rollbutton.gif"
if (txt == "b6")
document.b6.src ="images/rollbutton.gif"
if (txt == "b7")
document.b7.src ="images/rollbutton.gif"
if (txt == "b8")
document.b8.src ="images/rollbutton.gif"
if (txt == "b9")
document.b9.src ="images/rollbutton.gif"
if (txt == "b10")
document.b10.src ="images/rollbutton.gif"
}
function mouseOut(txt)
{
if (txt == "b1")
document.b1.src ="images/b1.PNG"
if (txt == "b2")
document.b2.src ="images/b2.PNG"
if (txt == "b3")
document.b3.src ="images/b3.PNG"
if (txt == "b4")
document.b4.src ="images/b4.PNG"
if (txt == "b5")
document.b5.src ="images/b5.PNG"
if (txt == "b6")
document.b6.src ="images/b6.PNG"
if (txt == "b7")
document.b7.src ="images/b7.PNG"
if (txt == "b8")
document.b8.src ="images/b8.PNG"
if (txt == "b9")
document.b9.src ="images/b9.PNG"
if (txt == "b10")
document.b10.src ="images/b10.PNG"
}
</script>
what I am trying to make it is...
function mouseOver(txt) document.+txt+.src ="images/"+txt+".PNG"
function mouseOut(txt) document.+txt+.src ="images/rollbutton.gif"
I mean you see what I want just I have no idea how to pull it off, I just want it to do it by itself to eliminate redundancy, redundancy hurts my eyes :(