PDA

View Full Version : Dynamic content in a Layer (DIV)


Marcus Dunkus
02-19-2005, 09:13 PM
Hi Folks, I am having trouble displaying my dynamic content in a layer.
The content shows up everywhere else. I have put my <%=itemDescription%> tag inside the <DIV> tag. Can this variable be used inside the DIV or do I need to repeat all the other connection code inside the DIV?
Ultimately I want to reveal a hidden description which is relevent to the link the user hovers over, so the layer will also need to move down with the cursor, but that's another issue. Any help would be apreciated, Thanks

miranda
02-20-2005, 03:49 AM
First off keep in mind that if you place your asp code at the top of the page above the <html> tag, or inside the <html></html> tags doesn't matter. With the exception of content written out using response.write that is not inside a sub routine. If you use sub routines then they can all be at the top of the page and then place the call to each one where you need it.

OK, now you are writing out the HTML and have the div tag. Are you putting this inside the tag as an attribute of the tag? As in the id, like so <div id="<%=itemDescription%>"> or are you doing so like this <div id="myTag" ><%=itemDescription%></div>? BTW you will need to use javascript on the client to view the div.

Marcus Dunkus
02-21-2005, 12:56 PM
Thanks for that Miranda, my asp code was outside the tag <div id="myTag" ><%=itemDescription%></div> I'll go and have a play with the positions of the code, why do I need Javascript for the DIV? do you mean to move it to the cursor height?
M

miranda
02-21-2005, 09:25 PM
ASP is processed on the server. Therefore, when you load the page all ASP code is processed, then the page is loaded and HTML is displayed. So if you have a hidden div, it is viewable in the source code but is hidden from view on the browser. The only way to view using asp would be to trigger a postback to the server, and then to hide it with asp you would again need to trigger another postback to the server. This is generally not an option. That is why it is done with a client side code, since there are no trips to the server needed. How many of these divs do you have on the page? I wrote a client side javascript to display a hidden div for one of my business clients that I can show you if that would help.

Marcus Dunkus
02-24-2005, 01:50 PM
Thanks again Miranda, sounds like your code would indeed be very helpful.
Just to recap fully:
I have 1 DIV(layer) with the ASP (item description) code in it. I was hoping to reveal the layer using javascript (that much works) when the user rolls over the name of the item, the description for that item pops up in the layer. To achieve this I was hoping to capture the ID for the item rolled over and pass that to the request in the layer. The layer would move down the page with the cursor.
Cheers
M