Hello Christophe,

Thursday, February 01, 2001, 2:31:28 PM, you wrote:

CT> Is there a prefered way to implement graphical buttons within a struts form ?

CT> By graphical buttons I mean 4-state buttons
CT> (enabled/disabled/mouseover/down) that display a different image for each state.

You can use html:image tag and specify appropriate client-side scripts
for image switching.
For example -

>> client-script code

<script LANGUAGE="JavaScript">
<!--

bName = navigator.appName;
bVer = parseInt(navigator.appVersion);
    if ((bName == "Netscape" && bVer >= 3) || 
        (bName == "Microsoft Internet Explorer" && bVer >= 4)) br = "n3"; 
    else br = "n2";

    if (br== "n3") { 
    img1on = new Image();
    img1on.src = "images/<bean:message key="abt.searchover"/>";

    img1off = new Image();
    img1off.src = "images/<bean:message key="abt.searchoff"/>";
    
    img1mdn = new Image();
    img1mdn.src = "images/<bean:message key="abt.searchclick"/>";

    }


function imgAct(sourceObj, imgName) {
    if (br == "n3") {
    sourceObj.src = eval(imgName + "on.src");
    }
}

function imgInact(sourceObj,imgName) {
    if (br == "n3") {
    sourceObj.src = eval(imgName + "off.src");
    }
}

function imgMDown(sourceObj,imgName) {
    if (br == "n3") {
    sourceObj.src = eval(imgName + "mdn.src");
    }
}

// -->
</script>

>> html:image tah

<html:image
   path="images/"
   src="abt.searchoff"
   isKey="true"
   onmouseover="imgAct(this,'img1')"
   onmouseout="imgInact(this,'img1')"
   onmousedown="imgMDown(this,'img1')">
 <bean:message key="srch.do"/>
</html:image>

-- 
Best regards,
 Oleg                            mailto:[EMAIL PROTECTED]


Reply via email to