Here is a compact function to convert HTML color to RGB:
function html2rgb($color){
return array(hexdec(substr($color, 0, 2)), hexdec(substr($color, 2, 2)), hexdec(substr($color, 4, 2)));
}
Here is a compact function to convert HTML color to RGB:
function html2rgb($color){
return array(hexdec(substr($color, 0, 2)), hexdec(substr($color, 2, 2)), hexdec(substr($color, 4, 2)));
}
HTML Select Element That Remembers Previous Selection in JSTL
Here is an JSTL code example that shows how to build a select box that remembers the previous selection.
<select name=’days‘>
<c:forTokens items="7;14;30;60;180; 365" delims=";" var="current">
<c:choose>
<c:when test="${current==param.days}">
<OPTION selected>
</c:when>
<c:otherwise>
<OPTION>
</c:otherwise>
</c:choose>
<c:out value="${current}" /></option>
</c:forTokens>
</select>
Each iteration checks an option value against a request parameter that contains the value of the selected option element. If they are equal, the HTML option tag is given a selected attribute.
Set JavaScript Array Values from JSTL Iteration Tags
Here is a simple example that shows how to populate Javascript array values from JSTL iteration tags:
<script type=’text/javascript’>
var arr = new Array();
<c:forEach begin="1" end="5" var="current">
arr.push(<c:out value="${current}" />);
</c:forEach>
</script>
The Javascript arr array now contains values from 1 to 5.