Webmaster Forum

Go Back   Webmaster Forum > Scripting/Programming & Debugging > ASP & VBScript Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

ASP & VBScript Forum Need help from a webmaster with ASP or VBScript, you may ask in this forum?

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-11-2008, 11:17 PM
Sleeping Troll Sleeping Troll is offline
Junior Member
 
Join Date: Apr 2008
Posts: 1
Sleeping Troll is an unknown quantity at this point
Submit to Clesto Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Jeqq Submit to Spurl
Default variables not recognised in function

This is my complete page:

<%@LANGUAGE=VBSCRIPT%>
<!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN>
<!--#include virtual=/adovbs.inc -->
<title>Panel</title>
<style type="text/css">
</style>
<head>
<%
Public x
Public y
x=0
y=0
MenuItem = Request.QueryString()
MenuItem = Replace(MenuItem,"%20"," ")
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "c:\inetpub\wwwroot\HawksWeb\HawksWeb.mdb"
Set ProductData=server.CreateObject("ADODB.RecordSet")
ProductData.CursorType = AdOpenStatic
ProductData.CursorLocation = AdUseClient
ProductData.ActiveConnection = conn
ProductData.Sort = "Category Asc, Menu Asc"
ProductData.open "Select * from WebData"
FilStr = "Menu = '" & MenuItem & "'"
SrtStr = "Package, Size, Flavor"
ProductData.Filter = FilStr
ProductData.Sort = SrtStr
ProdInfo = ProductData.GetRows()
ImgStr = ProdInfo(y,x)
ImgStr = "/Images/Products/" + ImgStr + ".png"
ProductData.Close
ProductData.ActiveConnection = nothing
%>
<style type="text/css">
<!--
body,td,th {
font-family: Arial, Helvetica, sans-serif;
}
.Heading {
font-family: "Arial Black";
font-size: 16px;
font-weight: bold;
}
body {
background-image: url(/images/Santa%20Fe%20Stucco.bmp);
background-repeat: repeat;
}
.style3 {font-size: 12px}
#Layer1 {
position:absolute;
width:99px;
height:24px;
z-index:1;
left: 144px;
top: 420px;
}
#Layer2 {
position:absolute;
width:100%;
z-index:1;
top: 0;
overflow: visible;
left: 0;
background-color: #FFFFFF;
}
-->
</style>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<script type="text/vbscript">
Function GetImg(Spin,Dir,x,y,ProdInfo)
TestCurr = ProdInfo(y,x)
TestNext = ProdInfo(y,x)
Do While TestCurr = TestNext
Select Case (Dir)
Case 0
If x = 0 then
x = ubound(ProdInfo(2))
Else
x = x - 1
End If

Case 1
If x = ubound(ProdInfo(2)) then
x = 0
Else
x = x +1
End If

End Select
TestNext = ProdInfo(Spin,x)
Loop
ImgStr = ProdInfo(y,x)
ImgStr = "/Images/Products/" + ImgStr + ".png"
Response.write(ImgStr)
end Function
</Script>


<%Response.write("<table width='100%' border='1' BorderColor= '0' cellspacing='0' cellpadding='0' bgcolor='#7575EE'><tr><td align='center'><p class='Heading'>" + MenuItem + "</p></td></tr></table>")%>
<td></td>
<td style="WIDTH: 302px"></td>
<td></td>
</tr>
<tr>
<td height="30"></td>
<td height="30" style="WIDTH: 302px"></td>
<td height="30"></td>
</tr>
</table>
</p>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2" bordercolor="#000000"><form name="form2" method="post" action="">
<div align="center">The product description goes here it should autowrap depending upon the browser window size </div>
</form> </td>
<td><div align="center" id="ProdImgDiv">
<img src="<%=ImgStr%>" name="ProdImg" border="0" id="ProdImg" />
<label></label>
</div></td>
<td colspan="2"><form name="form1" method="post" action="">
<div align="center">The product information goes here it should autowrap depending upon the browser window size </div>
</form></td>
</tr>
<tr>
<td width="136" rowspan="2">&nbsp;</td>
<td width="243" align="center" valign="middle">
<div align="center"><img name="SpinPkg" src="/images/Spin/SpinPkg.png" width="150" height="74" border="0" id="SpinPkg" usemap="#SpinPkg" alt="">
<map name="SpinPkg">
<area shape="poly" coords="123,35,108,43,108,26,123,35" alt="" OnClick = "ImgStr = GetImg('Package',0,x,y,ProdInfo)"/>
<area shape="poly" coords="27,36,42,27,42,45,27,36" alt="" OnClick = "ImgStr = GetImg('Package',1,x,y,ProdInfo)"/>
</map>
</div></td>
<td width="243" align="center" valign="middle">
<div align="center"><img name="SpinSze" src="Images/Spin/SpinSze.png" width="150" height="74" border="0" id="SpinSze" usemap="#SpinSze" alt="">
<map name="SpinSze">
<area shape="poly" coords="123,37,108,45,108,28,123,37" href="vbscript:" alt="" OnClick = "ImgStr = GetImg('Size',0,x,y,ProdInfo)"/>
<area shape="poly" coords="28,37,43,28,43,46,28,37" href="vbscript:" alt="" OnClick = "ImgStr = GetImg('Size',1,x,y,ProdInfo)"/>
</map>
</div></td>
<td width="243" align="center" valign="middle">
<div align="center"><img name="SpinFlv" src="Images/Spin/SpinFlv.png" width="150" height="74" border="0" id="SpinFlv" usemap="#SpinFlv" alt="">
<map name="SpinFlv">
<area shape="poly" coords="123,37,108,45,108,28,123,37" href="vbscript:" alt="" OnClick = "ImgStr = GetImg('Flavor',0,x,y,ProdInfo)"/>
<area shape="poly" coords="27,37,42,28,42,46,27,37" href="vbscript:" alt="" OnClick = "ImgStr = GetImg('Flavor',1,x,y,ProdInfo)"/>
</map>
</div></td>
<td width="143" rowspan="2">&nbsp;</td>
</tr>

<tr> </tr>

<tr>
<td width="136">&nbsp;</td>
<td width="243">&nbsp;</td>
<td width="243" height="60" align="center" valign="middle">
<img name="Add" src="images/Add/Add.png" width="179" border="0" id="Add" usemap="#Add" alt="" />
<map name="Add" id="Add">
<area shape="rect" coords="40,38,137,56" alt="" />
</map> </td>
<td width="243"><label></label></td>
<td width="143">&nbsp;</td>
</tr>
</table>


</body>

</html>

Problem is that " x, y and ProdInfo are not recognised in the function "GetImg" Debugger values for them is (Empty)
Reply With Quote

This ad is part of our Revenue Sharing program
  #2 (permalink)  
Old 05-14-2008, 08:39 PM
mcnd mcnd is offline
Junior Member
 
Join Date: May 2008
Posts: 3
mcnd is an unknown quantity at this point
Submit to Clesto Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Jeqq Submit to Spurl
Default Try this

OnClick="ImgStr=GetImg('Flavor',1,<%=cstr(x)%>,<%= cstr(y)%>,<%=cstr(ProdInfo)%>)"
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Form Variables vilen ASP & VBScript Forum 0 04-02-2008 03:43 PM
Declaration of public variables in vbscript sona90s ASP & VBScript Forum 1 10-19-2007 07:54 PM
Mid Function. Reading of files peachtea ASP & VBScript Forum 1 08-01-2007 01:33 AM
VBScript Function for Compound Primary Key wacara ASP & VBScript Forum 1 05-10-2007 02:29 PM
Filter Clean Function not working KIFIKA PHP Forum 1 03-15-2007 12:42 AM


All times are GMT. The time now is 03:09 AM.


Creative Commons License
Powered by vBulletin Version 3.6.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.0.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30