|
Page 1 of 1 |
spankie
VIP Member
Posts: 2958
Location: Belgium
|
Posted: Mon, 23rd Feb 2009 13:09 Post subject: im a VBscript noob |
|
 |
hi,
after doing PHP and perl for some years i decided to do some specialisation courses in oracle SQL and internet applications.
For some reasons the guy feels the need to teach us server based scripting. I thought, well a bit php and maybe java... but no
VBscript ASP. Ok, the one thing i dont know shit about, VB.
Im also working, so i dont have like a zillion hours to spend on my free day to keep looking for my stupid mistake. plz help me. We had to design a table in html with altering colours
Code: | <% Sub toonTabel(rows,columns,evenC,oddC,border,width)
Dim i,j
Response.Write ("<table width=" & width & "px; border=" & border & "px>")
for i=1 to rows
if (i Mod 2 = 0) then
Response.Write ("<tr bgcolor=" & evenC & ">")
else
Response.Write ("<tr bgcolor=" & oddC & ">")
end if
for j=1 to columns
Response.Write "<td></td>"
next
Response.Write "</tr>" & vbCr
next
Response.Write "</table>"
End Sub %>
<%
toonTabel 10,3,green,blue,2,400
%>
|
gives
Quote: |
<table width=400px; border=2px><tr bgcolor=><td></td><td></td><td></td></tr>
<tr bgcolor=><td></td><td></td><td></td></tr>
<tr bgcolor=><td></td><td></td><td></td></tr>
<tr bgcolor=><td></td><td></td><td></td></tr>
<tr bgcolor=><td></td><td></td><td></td></tr>
<tr bgcolor=><td></td><td></td><td></td></tr>
<tr bgcolor=><td></td><td></td><td></td></tr>
<tr bgcolor=><td></td><td></td><td></td></tr>
<tr bgcolor=><td></td><td></td><td></td></tr>
<tr bgcolor=><td></td><td></td><td></td></tr>
</table>
|
my colors are missing behind the tag and i dunno why...
|
|
Back to top |
|
 |
LeoNatan
Banned
Posts: 73193
Location: Ramat Gan, Israel 🇮🇱
|
Posted: Mon, 23rd Feb 2009 13:14 Post subject: |
|
 |
Why not use JScript for your ASP coding? I can't stand VB, let alone VBS. Everything is the same, only you write in a sane language.
But I think your problem is in the procedure call. Try:
Code: | toonTabel 10,3,"green","blue",2,400 |
The way you wrote it, you were trying to read from variables named "green" and "blue." They have to be strings.
In JScript:
Code: | <%@ LANGUAGE=JScript %>
<%
function ToonLabel(rows,columns,evenC,oddC,border,width)
{
Response.Write ("<table width=" + width + "px; border=" + border + "px>");
for(var i = 0; i < rows; i++)
{
if(i%2 == 0)
Response.Write("<tr bgcolor=" + evenC + ">");
else
Response.Write("<tr bgcolor=" + oddC + ">");
for(var j = 0; j < columns; j++)
Response.Write("<td></td>");
Response.Write("</tr>\n");
}
Response.Write("</table>");
}
%>
<%
ToonLabel(10,3,"green","blue",2,400);
%> |
|
|
Back to top |
|
 |
spankie
VIP Member
Posts: 2958
Location: Belgium
|
Posted: Mon, 23rd Feb 2009 13:44 Post subject: |
|
 |
well i have to use VBscript, i hate it as well. The syntax is really akward.
i have been coding in perl and php like for ages, but this VBscript doesnt feel natural
i mean, who uses as a conditional operator = instead of == or uses end if instead of using {}, phu
btw you were right with the quotes missing thing. thx.
|
|
Back to top |
|
 |
LeoNatan
Banned
Posts: 73193
Location: Ramat Gan, Israel 🇮🇱
|
Posted: Mon, 23rd Feb 2009 13:59 Post subject: |
|
 |
Read here:
http://www.kamath.com/columns/my3cents/mtc002_scripting.asp
Quote: | How about both?
ASP not only supports multiple scripting languages, but it lets you mix languages within a single page. For instance, you can have both JavaScript and VBScript routines on the same page. This ability, while it offers flexibility, is not all that efficient when you have a large number of pages. consider this only if necessary, when one language does not give you what you want. |
|
|
Back to top |
|
 |
Page 1 of 1 |
All times are GMT + 1 Hour |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB 2.0.8 © 2001, 2002 phpBB Group
|
|
 |
|