M
Mike
I have a function as follows:
function docolors(Rstart,Gstart,Bstart,color,incrementer)
r=Rstart
g=Gstart
b=Bstart
response.write "<div><table><tr>"
for color = 0 to 255
response.write "<td style=""background-color:rgb"
response.write "(" & r & "," & g & "," & b & ");"">"
response.write "<a href=""#"" title=""R"
response.write r & ":G" & g & ":B" & b & """>"
response.write " </a></td>"
color=color+incrementer
next
response.write "</tr></table></div>"
end function
When its called thus:
docolors 0,0,0,r,9
it increments the value of red by 9 and writes 26 table cells to the
page gradually going from black to red (which is what I want).
I have a form to collect user provided values for the function's
arguments and dynamically build a call to docolors() using the form
field values:
<%
sub dropdown()
for i = 0 to 255
response.write "<option value=""" & i & """>" & i & "</option>" &
vbcrlf
next
end sub
%>
<form action="" method="post">
<strong>Start Values</strong><br />
Red:<select name="r">
<%
dropdown
%>
</select>
Green:<select name="g">
<%
dropdown
%>
</select>
Blue:<select name="b">
<%
dropdown
%>
</select><br /><br />
<strong>Colour to increment value of:</strong><br />
<input type="radio" name="c" value="r" />Red<br />
<input type="radio" name="c" value="g" />Green<br />
<input type="radio" name="c" value="b" />Blue<br /><br />
<strong>Incrementer:</strong><br />
<select name="i">
<%
dropdown
%>
</select><br />
<input type="submit" name="submit" value="Submit" />
</form>
<%
x=cint(request.form("r"))
y=cint(request.form("g"))
z=cint(request.form("b"))
h=trim(cstr(request.form("c")))
i=cint(request.form("i"))
docolors x,y,z,h,i
%>
and it seems that all the values translate correctly if I
response.write the whole lot:
response.write "call docolors(" & x & "," & y & "," & z & "," & h & ","
& i & ")<br />"
but the thing fails to increment the value of h - the paramenter that
goes where color is in the function. x,y,z,and i all work as expected.
My logic is clearly faulty somewhere. Can anyone see where?
TIA
Mike
function docolors(Rstart,Gstart,Bstart,color,incrementer)
r=Rstart
g=Gstart
b=Bstart
response.write "<div><table><tr>"
for color = 0 to 255
response.write "<td style=""background-color:rgb"
response.write "(" & r & "," & g & "," & b & ");"">"
response.write "<a href=""#"" title=""R"
response.write r & ":G" & g & ":B" & b & """>"
response.write " </a></td>"
color=color+incrementer
next
response.write "</tr></table></div>"
end function
When its called thus:
docolors 0,0,0,r,9
it increments the value of red by 9 and writes 26 table cells to the
page gradually going from black to red (which is what I want).
I have a form to collect user provided values for the function's
arguments and dynamically build a call to docolors() using the form
field values:
<%
sub dropdown()
for i = 0 to 255
response.write "<option value=""" & i & """>" & i & "</option>" &
vbcrlf
next
end sub
%>
<form action="" method="post">
<strong>Start Values</strong><br />
Red:<select name="r">
<%
dropdown
%>
</select>
Green:<select name="g">
<%
dropdown
%>
</select>
Blue:<select name="b">
<%
dropdown
%>
</select><br /><br />
<strong>Colour to increment value of:</strong><br />
<input type="radio" name="c" value="r" />Red<br />
<input type="radio" name="c" value="g" />Green<br />
<input type="radio" name="c" value="b" />Blue<br /><br />
<strong>Incrementer:</strong><br />
<select name="i">
<%
dropdown
%>
</select><br />
<input type="submit" name="submit" value="Submit" />
</form>
<%
x=cint(request.form("r"))
y=cint(request.form("g"))
z=cint(request.form("b"))
h=trim(cstr(request.form("c")))
i=cint(request.form("i"))
docolors x,y,z,h,i
%>
and it seems that all the values translate correctly if I
response.write the whole lot:
response.write "call docolors(" & x & "," & y & "," & z & "," & h & ","
& i & ")<br />"
but the thing fails to increment the value of h - the paramenter that
goes where color is in the function. x,y,z,and i all work as expected.
My logic is clearly faulty somewhere. Can anyone see where?
TIA
Mike