开发者

Render a div inline somehere, when it's physically somewhere else?

Suppose you have this:

<div>Area 1</div>
<div style="clear:both;">Area 2</div>
    ... more arbitrary stuff
<div style="clear:both;">Area 3</div>

Is there any way you could make this render like below, without actually changing the order of the elements?

Area 1
Area 3
Area 2
... more abitrary stuff

Yeah it doesn't make sense, but the reason is (of course) asp.net. I want to create a file upload form inline, and not use an iFrame. So need to create a new form that's outside the single asp.net form. Since it's impossible to nest forms, the upload form must physically exist on the page outside of the other form. So I'm trying to figure out if there's any way to make it display inside an area that's technically part of the main form.

My working solution is to use a modal dialog with the 2nd form. This works fine, but if possible I'd like to have the upload form inline with the rest of the page and not be in a modal dialog.

I can imagine using absolute position to move the thing around, but I can't think how I could cau开发者_JAVA技巧se the other elements to adjust to the space consumed by the 3rd div without a great deal of javascript.


In general, I've been trying to avoid the single server-side form from ASP.net unless I really need it, if that's an option.

Could you create a "dummy" element of the same size as your form, so the browser locates everything else correctly, and then you absolutely position your form over the dummy element?


I do not think you can achieve this with an inline element as you have it laid out above.

What you could do is create an empty element in the main form which is a block element that has the exact same dimensions as your file upload element.

Then use absolute positioning on your file upload element and dynamically position it on page load to be positioned at exactly where your block element in the main form is on the page.

That way you get the positioning from your placeholder.

I'm not sure if there is a better way to accomplish this, but I'm sure this technique will work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜