MrBarefoot 0 Posted August 13, 2010 Report Share Posted August 13, 2010 Hi all I have a page where many divs are generated by a database. Each of these divs has a set of Style properties stored in the database ie. Top, Left, Width, Height…<%tid = 1 do while not objRS.eof tmpStrng = "<div id='div" & tid & "' class='drsElement drsMoveHandle' style=" tmpStrng = tmpStrng + "left:" & objRS("pX") & "px;" tmpStrng = tmpStrng + "top:" & objRS("pY") & "px;" tmpStrng = tmpStrng + "width:" & objRS("pW") & "px;" tmpStrng = tmpStrng + "height:" & objRS("pH") & "px;" tmpStrng = tmpStrng + "border-width:" & objRS("pBorder") & ";>" tmpStrng = tmpStrng + "background-image:url(" & objRS("pBkg") & ");" tmpStrng = tmpStrng + "<div style='overflow:hidden;height:100%'>" tmpStrng = tmpStrng + "<img src=" & objRS("pImage") & " width='100%' height='100%'>" tmpStrng = tmpStrng + "</div></div>" response.write(tmpStrng) tid = tid + 1 objRS.movenext Loop%> Then some JavaScript allows you to drag and drop, and resize all these divs. No problems there. Now, when one clicks “Save” (submit), I need the page to loop through all the divs and retrieve their new Style properties, and save the data back to the database. All of the database scripting is asp, and I am using an Access database. How do I get asp to read the style properties of a div?ThanksDave Quote Link to post Share on other sites
justsomeguy 1,135 Posted August 13, 2010 Report Share Posted August 13, 2010 ASP isn't going to read anything on the page, you need to use Javascript to collect all of that information and add it to the form before it submits. Quote Link to post Share on other sites
Striped Fish2 1 Posted August 14, 2010 Report Share Posted August 14, 2010 The way I would go about solving this problem would be to have just 2 fields in the database width and height and as it is being constructed by asp to pull the values from the database and write them in the style. Then have 2 hidden fields on the page that have the take on the value of the width and height of each of the dividers. Then when the user hits save it would send the values of the hidden fields to the asp page which would update the database. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.