Change "input=button" to "input=image"

I have this line of code:
<input class="EXPAND" type=button value="+" name="B<%=cNum%>" onclick="return expand(this);">
and the function below

If change the above line to an image:
<input class="EXPAND" type=image src="..\image\arrow.jpg" name="B<%=cNum%>" onclick="return expand(this);">

*** then how can I change that "btn.value" to check for the image?? I dont have "value" anymore..
function expand(btn)
{
    var idnum = btn.name.substring(1); // everything after the B
    var dv = document.getElementById("EX"+idnum);
    if ( btn.value == "+" )
    {
        btn.value = "-";
        btn.className = "COLLAPSE";
        dv.style.display = "block";
    } else {
        btn.value = "+";
        btn.className = "EXPAND";
        dv.style.display = "none";
    }
}

Open in new window

LVL 8
CamilliaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hieloCommented:
You can still leave the value attribute on the <input type="image"> and not affect your page. This way you don't have to change anything:

<input class="EXPAND" type=image src="..\image\arrow.jpg" name="B<%=cNum%>" onclick="return expand(this);" value="+">

Another alternative would be:
<input class="EXPAND" type=image src="..\image\arrow.jpg" name="B<%=cNum%>" onclick="return expand(this);" rel="+">
and use this:
function expand(btn)
{
    var idnum = btn.name.substring(1); // everything after the B
    var dv = document.getElementById("EX"+idnum);
    if ( btn.rel == "+" )
    {
        btn.rel = "-";
        btn.className = "COLLAPSE";
        dv.style.display = "block";
    } else {
        btn.rel = "+";
        btn.className = "EXPAND";
        dv.style.display = "none";
    }
}

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CamilliaAuthor Commented:
let me see, thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.