Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

image inserting

Status
Not open for further replies.

rtnMichael

Programmer
Aug 5, 2002
152
US
Hey, I was wondering how I would go about dynamically inserting a .gif in a page to determine a pass/fail indication. I have a form taking in values and having upper and lower limits, and once the value is inserted (with the help of the onblur tag) I get a Pass/Fail indicator, but I want to insert an image of, say a red or green light ball to indicate it instead of just a "Pass". This is for each form line, not an overall pass/fail, each value is validated once inserted. How can I do that?

Thanks
Mike
 
<script>
function checkVal(){
theVal = document.getElementById(&quot;myText&quot;).value
if (theVal > someVal && theVal < anotherVal){
pic = &quot;good.gif&quot;
}
else{
pic = &quot;bad.gif&quot;
}
document.getElementById(&quot;passFail&quot;).innerHTML = &quot;<img src='&quot; & pic & &quot;'>&quot;
}
</script>

<input onBlur=&quot;checkVal()&quot; id=&quot;myText&quot;>
<span id=&quot;passFail&quot;></span>

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

fart.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top