4

I'm using the [object] tag to display the text of a .txt file. The object is within a div. When the object loads the text it sets up in a frame, which I can define height and width. However, setting the height to auto, or 100% does nothing. No matter what I do the area in which the text is displayed is small, with scroll bars. I want the div that the object is contained in, along with the object itself, to stretch to show all the text.

Here is the line:

<object type="text/html" data="./docs/description_a.html" style="width:100%; "></object>

But no matter what I do I cannot get it to stretch based on the length of the text. Any help is much appreciated.


Most probably, the reason you cannot handle the exception in the new AppDomain is that it is not thrown from a thread that was created in that AppDomain. From the documentation on AppDomain.UnhandledException it is not very straight-forward to see that. The interesting part is the following:

An exception is unhandled only if the entire stack for the thread has been unwound without finding an applicable exception handler, so the first place the event can be raised is in the application domain where the thread originated.

Now if the thread that executes the code that throws, is created in your main AppDomain (like the main thread of a console app), then you should add a handler in the main AppDomain. Note though that if the type of the thrown exception is not loaded in the main AppDomain, the Assembly Loader of .NET will try to load it from your applications' base directory and probing paths. If these are not the same with the child AppDomain, then the assembly will not be resolved and an(other) exception will be thrown.

4

1 回答 1

2

http://jsfiddle.net/XAaMV/4/

您可以使用 jQuery 动态设置高度和宽度:

$(document).ready(function(){

    $("#obj").width($("#cont").width());
    $("#obj").height($("#cont").height());

});

HTML:

<div id="cont">
<object id="obj" width="" height="" data="www.google.com"></object>
 <div>   

解决方案 2

<div>
<object width="600" height="900" data="www.google.com"></object>
 <div>

CSS

div{

    height:600px;
    width:900px;
}
于 2013-03-27T00:03:01.413 回答