简体   繁体   English

JavaScript标记在HTML代码中产生中断

[英]JavaScript tag is generating break in HTML code

I got this JavaScript tag which is displaying a banner on my page: 我得到了这个JavaScript标记,该标记在页面上显示横幅:

<script src="http://e2.emediate.se/eas?cu=10524;cre=mu;js=y" 
  language="JavaScript" type="text/javascript"></script>
<embed 
   height="150" 
   width="768" 
   type="application/x-shockwave-flash"
   src="http://e2.emediate.se/media.2/170/4045/32676/49312404-768-150.swf?clickTAG=http://e2.emediate.se/eas?camp=32676::cu=10524::no=60039::ty=ct"
>

I use PHP and XSLT. 我使用PHP和XSLT。

The banner is showing all good, but it is also generating a invisible break. 标语显示一切都很好,但同时也产生了看不见的中断。 This is a problem because I got another small banner to the right. 这是一个问题,因为我在右边还有另一个小横幅。 Which is pushed down because of the break. 由于中断而被压低。

Is this a weird XSLT-issue? 这是一个奇怪的XSLT问题吗? Someone got any idea? 有人知道吗?

what is the content of the banner? 标语的内容是什么? the script tag itself is invisible. 脚本标签本身是不可见的。 you need to check the content of the banner itself and see what exactly is breaking. 您需要检查标语本身的内容,看看到底是什么在破坏。 use FireBug to check the content after load and to see exactly what broke. 使用FireBug在加载后检查内容,并准确查看损坏的内容。

e : looking at the embed you posted- 2 things to check- 1st, imo- embed tags' display is block, so to you might have to set it inline/float it. e :查看您张贴的嵌入-要检查的两件事-首先,未嵌入标签的显示被阻止,因此您可能必须将其设置为内联/浮动。 2nd- make sure that the width of the object is small enough to be contained with the other one inside their container. 第二-确保物体的宽度足够小,以便另一个物体可以容纳在其容器内。 for both to be fixed, you probably gonna have to edit the script (at the very least, you will need to find a way to style the embed) 为了将两者都修复,您可能必须编辑脚本(至少,您将需要找到一种样式化嵌入的方式)

You should post code of what HTML the javascript generates. 您应该发布javascript生成HTML的代码。 But consider this: 但是考虑一下:

 <script etc></script><div id='theOtherBanner'>sdf</div>

If the script would generate something like: 如果脚本会生成如下内容:

 <div id='firstBanner'>Bla</div>

Then the second banner will be pushed down because divs are block-level elements. 然后第二个横幅将被向下推,因为div是块级元素。 You should make the divs display:inline; 您应该使divs display:inline; or float them. 或漂浮它们。 When floating make sure you clear the float using something like: 浮动时,请确保使用以下方法清除浮动:

 <br style='clear:both'>

After the floated divs. 在浮动股利之后。

Yeah, wrap that up in a span: 是的,把它包起来:

<span id="myexternalbanner"?
  <script type="text/javascript" language="JavaScript" src="http://something.com" ></script>
</span>

Then style that. 然后样式。 You'll most probably need to inspect the generated HTML with DOM Inspector or something like that, but this should work: 您很可能需要使用DOM Inspector或类似的工具来检查生成的HTML,但这应该可以工作:

span#myexternalbanner *{
  display: inline;
}

Maybe you'll need to float to left, but that'll be trickier. 也许您需要向左浮动,但这会比较棘手。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM