...

View Full Version : adapting image function to use text



geebee08
07-25-2008, 01:20 AM
hi, i have some code i'm trying to adapt from using an image to using text. right now i have a "box" image that has mouseover, select and deselect functions. i'd like to use text instead. is this possible with this piece of code? here's what i'm using, any thoughts appreciate.




function boxMouseOver (num) {
document.images['box' + num].src = 'images/box_on.gif';
}

function boxSelect (num) {
if ( boxSelected )
document.images['box' + boxSelected].src = 'images/box_off.gif';
boxMouseOver (num);
boxSelected = num;
makeInActive('info');
}

function boxDeSelect () {
if ( boxSelected )
document.images['box' + boxSelected].src = 'images/box_off.gif';
boxSelected = 0;
}

function boxMouseOut (num) {
if ( boxSelected != num )
document.images['box' + num].src = 'images/box_off.gif';
}

function makeActive (targetId)
{
if (document.getElementById)
{
target = document.getElementById( targetId );
if (target)
target.className = "active";
}
}

function makeInActive (targetId)
{
if (document.getElementById)
{
target = document.getElementById( targetId );
if (target)
target.className = "inactive";
}
}


here's the line



<a href="javascript://" onClick="boxSelect(1); onMouseOver="boxMouseOver (1)" onMouseOut="boxMouseOut(1)"><IMG SRC="images/box_on.gif" WIDTH="13" HEIGHT="18" name="box1" border=0></a>

rangana
07-25-2008, 03:09 AM
I'm having difficulty seeing your end result. Anyway, could you state what your goal is. We might be able to whip one for you.

geebee08
07-25-2008, 05:49 PM
hey rangana, i'm creating a portfolio for a client that's grabbing images via php. i'd like to have numbers along the bottom of the images that people can click to view the images. these numbers need to have mouseover, selected, deselected and mouseout states. i used to use images of boxes, but now the client would like it to be numbers. i'm wondering if the code i have above is something that can be changed to numbers.
i also sent an email to you about this. thanks much

rangana
07-26-2008, 01:43 AM
Okay, I see your the goal. Thanks. Since you want to replace image with text (numbers), what behavior do you expect? For onmouseover, onclick and onmouseout event?

Sidenote, I've received your email, but the link you've given failed. You might want to send it back to me.

geebee08
07-27-2008, 03:05 AM
well, a click is triggering a screen wipe transition, here's the full line of code:



<a href="javascript://" onClick="boxSelect(1); doWipeTrans('wipeDiv1','in left')" onMouseOver="boxMouseOver (1)" onMouseOut="boxMouseOut(1)"><IMG SRC="images/box_on.gif" WIDTH="13" HEIGHT="18" name="box1" border=0></a>


but i've got the wipe working fine. just need to figure out how to change this to numbers (text) instead of images with the same characteristics, namely onmouseover, onclick and onmouseout events. i tried using numbers and a <div name="box1">, but i don't know enough about the javascript to change it to be numbers.

geebee08
07-27-2008, 03:03 PM
i'm going to scrap the image code and use this:




function makeActive (targetId)
{
if (document.getElementById)
{
target = document.getElementById( targetId );
if (target.className == "inactive")
{
// make any active target inactive before this one becomes active
if ( activeTarget )
{ activeTarget.className = "inactive"; }

target.className = "active";
activeTarget = target;
}
}
}



simple. thanks for looking over this with me.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum