简体   繁体   English

垂直文本滚动中断页面布局的Javascript

[英]Javascript for vertical text scroll breaking page layout

My code was validating perfectly and looked great, until I added a vertical text scroller script to the left most floating div in a 3 column css layout. 我的代码可以完美验证并且看起来不错,直到我在3列CSS布局中向最左侧的div区域添加了垂直文本滚动器脚本为止。 Adding the script causes content below the script to repeat - both text and backgrounds - in several modern browsers (IE 6.0 - 7.0 - 8.0, Opera 8 - 9- 10). 添加脚本会导致脚本下方的内容在几种现代浏览器(IE 6.0-7.0-8.0,Opera 8-9-10)中重复出现,包括文本和背景。 Safari and Firefox are OK. Safari和Firefox都可以。

The script is JavaScript, and you add it by placing this code where you want the scroller to appear on the page, in my case inside the 3rd floated div: 该脚本是JavaScript,您可以通过将以下代码放置在希望滚动条显示在页面上的位置来添加它(在我的情况下是在第三个浮动div中):

<script language="javascript" src="myvsbody.js" type="text/javascript">
            </script>

There is also an onload property that goes in the body tag: 在body标签中还有一个onload属性:

<body onload="vsscrollstart();">

and a parameters script in the head area that formats the scroller box: 头部区域中的参数脚本可格式化滚动框:

<script language="javascript" src="myvsparmsg.js" type="text/javascript">

The script is supposed to be cross browser compatible. 该脚本应该与跨浏览器兼容。

Here is the web page online and links to the code: 这是在线网页和代码链接:

http://www.jillknobloch.com/new/
../new/main.css
../new/myvsbody.js
../new/myvsparmsg.js

I thought I had hold of a bad script, so I tried another one and the same layout problem reoccurred!! 我以为我掌握了一个错误的脚本,所以我尝试了另一个脚本,并且再次出现相同的布局问题! So I think it's my XHTML/CSS. 所以我认为这是我的XHTML / CSS。 Also because the script does work across all browsers when used in this template, which I got from template world and loaded on my site: 同样是因为该脚本在此模板中使用时确实可以在所有浏览器上运行,所以我是从模板世界获得并加载到我的网站上的:

www.jillknobloch.com/test5/ www.jillknobloch.com/test5/

I HAVE SPENT ABOUT 48 HOURS STARRING AT THE TEMPLATE WORLD PAGE TRYING TO FIND THE DIFFERENCE BETWEEN THAT CODE AND MINE AND I CANNOT FIGURE OUT WHY THE TEXT SCROLL SCRIPT WORKS ON THAT PAGE AND NOT ON MINE. 我花了大约48小时在模板世界页面上加注星标,以尝试查找代码和矿之间的差异,但我无法弄清楚文本滚动脚本为何在该页面而不是在矿上工作。

I am a new Javascipt programmer, and any help would be greatly appreciated! 我是Javascipt的新程序员,任何帮助将不胜感激!

Thank you 谢谢

Jill Knobloch 吉尔·诺布洛奇(Jill Knobloch)

I couldn't find anything wrong in the problematic browsers you mentioned, but the HTML validation error is caused by the language attribute on the script tags. 在您提到的有问题的浏览器中,我找不到任何错误,但是HTML验证错误是由脚本标签上的language属性引起的。 It is not needed. 不需要。 Try this instead: 尝试以下方法:

<script src="myvsbody.js" type="text/javascript"></script>

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

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