如何让表行中的 Applet 动态调整大小
我需要将一个小程序插入表行并获取该表行的高度以根据浏览器的窗口大小动态调整大小。如果我为宽度和宽度设置固定值td-tag 中的高度,它可以很好地显示小程序,但我需要能够根据客户端的大小功能调整其大小,因此使用固定大小不是答案。
下面的代码片段应该说明我的问题所在:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JavaAppletTest </title>
</head>
<body bgcolor="#6f6f6f" >
<table border="0" cellspacing="0" cellpadding="0" width="100%" >
<tr valign="top">
<td><img src="images/myheader.jpg" alt="myheader.jpg"></td>
<td><img src="images/mylogo.jpg" alt="mylogo.jpg"></td>
</tr>
<tr >
<td colspan="2" >
<object codetype="application/java"
classid="java:applets.MyTestApplet.class">
<param name="codebase" value="." >
<param name="archive" value="MyTestApplet.jar" >
<param name="code" value="applets.MyTestApplet" >
</object>
</td>
</tr>
</table>
</body>
</html>
我需要做什么才能使行维度动态化?
[编辑] jitter的答案表明了一个可能的解决方案。当用户调整窗口大小时,我还需要调整相关大小:什么事件和事件?我该怎么做?
I need to insert an applet into a table-row and get that table-row's height to dynamically resize according to the browser's window size. If I put fixed values for width & height in the td-tag, it shows the applet fine, but I need to be able to resize this according to the client's size capabilities, so using fixed sizes is not the answer.
The snippet below should illustrate where my problem lies:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JavaAppletTest </title>
</head>
<body bgcolor="#6f6f6f" >
<table border="0" cellspacing="0" cellpadding="0" width="100%" >
<tr valign="top">
<td><img src="images/myheader.jpg" alt="myheader.jpg"></td>
<td><img src="images/mylogo.jpg" alt="mylogo.jpg"></td>
</tr>
<tr >
<td colspan="2" >
<object codetype="application/java"
classid="java:applets.MyTestApplet.class">
<param name="codebase" value="." >
<param name="archive" value="MyTestApplet.jar" >
<param name="code" value="applets.MyTestApplet" >
</object>
</td>
</tr>
</table>
</body>
</html>
What do I need to do to make the row-dimensions dynamic?
[edit]
jitter's answer indicates a possible solution. I also need to adjust the relevant sizes when the user resizes the window: what event & how do I do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我建议使用javascript编写
object
/embed
标签并动态计算大小。这基本上应该可以解决问题,但要注意获得正确的宽度和尺寸可能很棘手。我建议您参考查找浏览器窗口的大小。
I suggest using javascript to write the
object
/embed
tag and calculating the size dynamically.This should do the trick basically but be aware of the fact that getting the correct width and size can be tricky. I refer you to Finding the size of the browser window.