Hi all,
I'm basically working with asp for the most part; however, I need to utilize JS that interact with ASP for a particular job. Here's the code:
And, here is the page-source
Problem:
The first tab which is Description is working fine displaying its field accordingly. However, the other 3 are just wrong that display the exact same information from the Description as well.
Something that I missed here, please help.
I'm basically working with asp for the most part; however, I need to utilize JS that interact with ASP for a particular job. Here's the code:
Code:
<script language="javascript">
function getTab(tabName,desc)
{
document.getElementById("product-info").innerHTML = myTabs[tabName,desc];
}
</script>
<%
dim sql, rs, arrProd
dim strMsg
sql = "SELECT COUNT(*) AS total FROM tblProducts"
Set rs = objConn.Execute(sql)
total = rs("total") - 1
call closeRS(rs)
sql = "SELECT longName,desc,largeImage,features,applications,requirements,idProduct " _
& " FROM tblProducts"
Set rs = objConn.Execute(sql)
If NOT rs.eof then
response.write "<script>"
response.write "var myTabs = new Array(" & total & ");"
dim i,j
i = 0
dim desc
desc = ""
For i = 0 to total
response.write "myTabs["&i&"] = new Array(2);"
For j = 0 to 3
if j = 0 then
desc = Replace(rs("desc"),vbcrlf,". ")
response.write "myTabs["&i&"]["&j&"] = """ & desc & """;"
elseif j = 1 then
features = Replace(rs("features"),vbcrlf,". ")
response.write "myTabs["&i&"]["&j&"] = """ & features & """;"
elseif j = 2 then
applications = Replace(rs("applications"),vbcrlf,". ")
response.write "myTabs["&i&"]["&j&"] = """ & applications & """;"
else
requirements = Replace(rs("requirements"),vbcrlf,". ")
response.write "myTabs["&i&"]["&j&"] = """ & requirements & """;"
end if
Next
Next
response.write("</script>")
Else
strMsg = "Our database is under re-construction.<BR>Please check back later."
End If
call closeRS(rs)
%>
<div id="main">
<img src="images/divider-line.jpg" width="940" />
<div id="product-box">
<div class="product-img">
<img src="images/newprod.jpg" />
</div>
<div class="product-desc"><p style="color:#fff; padding:10px 10px 0 10px; margin:0">
</p></div>
</div>
<img src="images/divider-line.jpg" width="940" style="margin-top:5px" />
<div id="product-box" id="tab1">
<ul id="tabnav">
<li><a href="javascript:getTab(1,0);">Description</a></li>
<li><a href="javascript:getTab(1,1);">Features</a></li>
<li><a href="javascript:getTab(1,2);">Applications</a></li>
<li><a href="javascript:getTab(1,3);">Minimum Requirements</a></li>
</ul>
<div id="product-info"><p>
</p></div>
</div>
</div>
Code:
<script language="javascript">
function getTab(tabName,desc)
{
document.getElementById("product-info").innerHTML = myTabs[tabName,desc];
}
</script>
<script>var myTabs = new Array(3);myTabs[0] = new Array(2);myTabs[0][0] = "advanTRAK allows businesses to automatically identify, track, receive, put-away, find and ship all items and products from inventory locations including a warehouse, stockroom or external distribution center. Using advanTRAK all items will be identified and recorded accurately with a barcode ID, item description and a product image. advanTRAK offers a full audit trail of receipts, adjustments and shipments to simplify accounting functions and eliminate shrinkage.<br /><br />Ideally created to work in many business environments, advanTRAK will automate and eliminate the paperwork process by using the portable advanTRAK barcode data terminal to receive, put-away, ship and audit all items to and from inventory.<br /><br />Your advanTRAK portable barcode terminal will allow automated receiving of items and will enable users to identify the correct inventory location for every item. The advanTRAK terminal is a portable device which allows greater mobility to receive and ship items from anywhere at your location. You will know better, what you have and where it is in inventory.<br /><br />The advanTRAK portable barcode terminal will identify location, quantity received and available. It will also enable faster sales order picking from inventory as well as better management of product for re-ordering. advanTRAK maintains a daily record and reporting of all transactions.<br /><br />As the advanTRAK portable terminal allows mobile data collection, it simplifies the task of physical inventory counts, improving efficiency and offering tremendous time savings. It will benefit your business by saving time to identify what is 'on hand' and available at all times. advanTRAK works to effectively eliminate inventory errors and improve sales for your business, allowing you to focus on efficiency and improved bottom line results.";myTabs[0][1] = "Identify all inventory. Item tracking. Eliminate paperwork. Better stock turns. Import/export data. . ";myTabs[0][2] = "Personal. Small Company. Large Organization. . ";myTabs[0][3] = "Windows® 2000, XP and Vista. Pentium® II or Greater Processor. 128 MB RAM, 500 MB Free HD Space. . ";myTabs[1] = new Array(2);myTabs[1][0] = "advanTRAK allows businesses to automatically identify, track, receive, put-away, find and ship all items and products from inventory locations including a warehouse, stockroom or external distribution center. Using advanTRAK all items will be identified and recorded accurately with a barcode ID, item description and a product image. advanTRAK offers a full audit trail of receipts, adjustments and shipments to simplify accounting functions and eliminate shrinkage.<br /><br />Ideally created to work in many business environments, advanTRAK will automate and eliminate the paperwork process by using the portable advanTRAK barcode data terminal to receive, put-away, ship and audit all items to and from inventory.<br /><br />Your advanTRAK portable barcode terminal will allow automated receiving of items and will enable users to identify the correct inventory location for every item. The advanTRAK terminal is a portable device which allows greater mobility to receive and ship items from anywhere at your location. You will know better, what you have and where it is in inventory.<br /><br />The advanTRAK portable barcode terminal will identify location, quantity received and available. It will also enable faster sales order picking from inventory as well as better management of product for re-ordering. advanTRAK maintains a daily record and reporting of all transactions.<br /><br />As the advanTRAK portable terminal allows mobile data collection, it simplifies the task of physical inventory counts, improving efficiency and offering tremendous time savings. It will benefit your business by saving time to identify what is 'on hand' and available at all times. advanTRAK works to effectively eliminate inventory errors and improve sales for your business, allowing you to focus on efficiency and improved bottom line results.";myTabs[1][1] = "Identify all inventory. Item tracking. Eliminate paperwork. Better stock turns. Import/export data. . ";myTabs[1][2] = "Personal. Small Company. Large Organization. . ";myTabs[1][3] = "Windows® 2000, XP and Vista. Pentium® II or Greater Processor. 128 MB RAM, 500 MB Free HD Space. . ";myTabs[2] = new Array(2);myTabs[2][0] = "advanTRAK allows businesses to automatically identify, track, receive, put-away, find and ship all items and products from inventory locations including a warehouse, stockroom or external distribution center. Using advanTRAK all items will be identified and recorded accurately with a barcode ID, item description and a product image. advanTRAK offers a full audit trail of receipts, adjustments and shipments to simplify accounting functions and eliminate shrinkage.<br /><br />Ideally created to work in many business environments, advanTRAK will automate and eliminate the paperwork process by using the portable advanTRAK barcode data terminal to receive, put-away, ship and audit all items to and from inventory.<br /><br />Your advanTRAK portable barcode terminal will allow automated receiving of items and will enable users to identify the correct inventory location for every item. The advanTRAK terminal is a portable device which allows greater mobility to receive and ship items from anywhere at your location. You will know better, what you have and where it is in inventory.<br /><br />The advanTRAK portable barcode terminal will identify location, quantity received and available. It will also enable faster sales order picking from inventory as well as better management of product for re-ordering. advanTRAK maintains a daily record and reporting of all transactions.<br /><br />As the advanTRAK portable terminal allows mobile data collection, it simplifies the task of physical inventory counts, improving efficiency and offering tremendous time savings. It will benefit your business by saving time to identify what is 'on hand' and available at all times. advanTRAK works to effectively eliminate inventory errors and improve sales for your business, allowing you to focus on efficiency and improved bottom line results.";myTabs[2][1] = "Identify all inventory. Item tracking. Eliminate paperwork. Better stock turns. Import/export data. . ";myTabs[2][2] = "Personal. Small Company. Large Organization. . ";myTabs[2][3] = "Windows® 2000, XP and Vista. Pentium® II or Greater Processor. 128 MB RAM, 500 MB Free HD Space. . ";myTabs[3] = new Array(2);myTabs[3][0] = "advanTRAK allows businesses to automatically identify, track, receive, put-away, find and ship all items and products from inventory locations including a warehouse, stockroom or external distribution center. Using advanTRAK all items will be identified and recorded accurately with a barcode ID, item description and a product image. advanTRAK offers a full audit trail of receipts, adjustments and shipments to simplify accounting functions and eliminate shrinkage.<br /><br />Ideally created to work in many business environments, advanTRAK will automate and eliminate the paperwork process by using the portable advanTRAK barcode data terminal to receive, put-away, ship and audit all items to and from inventory.<br /><br />Your advanTRAK portable barcode terminal will allow automated receiving of items and will enable users to identify the correct inventory location for every item. The advanTRAK terminal is a portable device which allows greater mobility to receive and ship items from anywhere at your location. You will know better, what you have and where it is in inventory.<br /><br />The advanTRAK portable barcode terminal will identify location, quantity received and available. It will also enable faster sales order picking from inventory as well as better management of product for re-ordering. advanTRAK maintains a daily record and reporting of all transactions.<br /><br />As the advanTRAK portable terminal allows mobile data collection, it simplifies the task of physical inventory counts, improving efficiency and offering tremendous time savings. It will benefit your business by saving time to identify what is 'on hand' and available at all times. advanTRAK works to effectively eliminate inventory errors and improve sales for your business, allowing you to focus on efficiency and improved bottom line results.";myTabs[3][1] = "Identify all inventory. Item tracking. Eliminate paperwork. Better stock turns. Import/export data. . ";myTabs[3][2] = "Personal. Small Company. Large Organization. . ";myTabs[3][3] = "Windows® 2000, XP and Vista. Pentium® II or Greater Processor. 128 MB RAM, 500 MB Free HD Space. . ";</script>
<div id="main">
<img src="images/divider-line.jpg" width="940" />
<div id="product-box">
<div class="product-img">
<img src="images/newprod-advanTRAK.jpg" />
</div>
<div class="product-desc"><p style="color:#fff; padding:10px 10px 0 10px; margin:0">
</p></div>
</div>
<img src="images/divider-line.jpg" width="940" style="margin-top:5px" />
<div id="product-box" id="tab1">
<ul id="tabnav">
<li><a href="javascript:getTab(1,0);">Description</a></li>
<li><a href="javascript:getTab(1,1);">Features</a></li>
<li><a href="javascript:getTab(1,2);">Applications</a></li>
<li><a href="javascript:getTab(1,3);">Minimum Requirements</a></li>
</ul>
<div id="product-info"><p>
</p></div>
</div>
</div>
The first tab which is Description is working fine displaying its field accordingly. However, the other 3 are just wrong that display the exact same information from the Description as well.
Something that I missed here, please help.