- Total Members: 220,002
- Threads: 525,379
- Posts: 976,969
-
November 14th, 2012, 03:06 PM
#1
Printing in a specific div based upon a Id
Hi all,
I am printing content dynamically into some div's based upon a criteria...Those div's are already defined in HTML and I am inserting the code into them through VBScript. SO I need to put some data into different div's based upon a criteria. So, when I am trying to print the content into an already defined Div with a specific ID its creating a new Id. So I am not sure of how to tell the code to print in a specific Id. I am posting here my code for your reference
<div class="div-table-row">
<div class="div-table-col-large-elec" id="x"></div>
<div class="div-table-col-small-large-elec" id="y"></div>
<div class="div-table-col-small-large-elec" id="w"></div>
<div class="div-table-col-small-large-elec-right-corner" id="z"></div>
<%
dim a(10),b(10)
a(0)=1
a(1)=2
a(2)=3
a(3)=4
a(4)=5
b(0)=6
b(1)=7
b(2)=8
b(3)=9
b(4)=10
Response.write "<div class=""div-table-col-large-elec"" id=""x"">"
for i=1 to UBound(a)
if(a(i)<>"") then
if(a(i)=2 or a(i)=3) then
response.write a(i)
response.write"<div class=""div-table-col-small-large-elec"" id=""y"">"&b(i)&"<br>"
response.write"<div class=""div-table-col-small-large-elec"" id=""w"">"&b(i)&"<br>"
response.write"<div class=""div-table-col-small-large-elec-right-corner"" id=""z"">"&b(i)&"<br>"
end if
end if
next
Response.write "</div>"
Response.write "</div>"
Response.write "</div>"
Response.write "</div>"
I need to print into above defined HTML div's and then finally close them ....As you can see, I need to print in one div(x) and based upon the entry present in the div x I need to print some other data in another div(y and z) but they should be closed only on end of loop so that the array is completely processed...
But the code is creating a new div everytime...
can anyone pls tell me how to print the content to an already defined div?
Thanks,
-
November 16th, 2012, 10:15 AM
#2
I'm not sure what you are trying to achieve, but you define div's on top of you code and it is html, so it is send to browser as is... after that in asp code you use response.write values from array and, but response.write create html code which goes to browser, so as result you have
<div class="div-table-col-large-elec" id="x"></div> from first part and <div class="div-table-col-large-elec" id="x"> from response.write and the creates second div with the same ID....
GK
__________________________________________________ _____
if you found this post is useful click scale

(right side on this reply ) and agree
Similar Threads
-
By UKFlyer in forum ASP Development
Replies: 2
Last Post: June 18th, 2011, 06:17 AM
-
By tcsikany in forum Microsoft Access Help
Replies: 6
Last Post: May 19th, 2010, 02:53 PM
-
By ddennis in forum Microsoft Access Help
Replies: 3
Last Post: February 25th, 2005, 09:09 AM
-
By solepixel in forum Microsoft Access Help
Replies: 4
Last Post: October 14th, 2004, 10:26 AM
-
By keg03009 in forum Microsoft Access Help
Replies: 3
Last Post: July 2nd, 2004, 10:22 AM