??xml version="1.0" encoding="utf-8" standalone="yes"?> Firebug是网开发的利器Q能够极大地提升工作效率?br /> 但是Q它不太Ҏ上手。我曄译q一?a target="_blank" style="color: #1a356e; text-decoration: initial;">《Firebug入门指南?/a>Q介l了一些基本用法。今天,l箋介绍它的高用法?/p> =================================== Firebug控制台详?/strong> 作者:阮一?br />出处Qhttp://www.ruanyifeng.com/blog/2011/03/firebug_console_tutorial.html 一、显CZ息的命o Firebug内置一个console对象Q提?U方法,用来昄信息?/p> 最单的Ҏ是console.log()Q可以用来取代alert()或document.write()。比如,在网脚本中使用console.log("Hello World")Q加载时控制台就会自动显C如下内宏V?/p> 另外Q根据信息的不同性质Qconsole对象q有4U显CZ息的ҎQ分别是一般信息console.info()、除错信息console.debug()、警告提Cconsole.warn()、错误提Cconsole.error()?/p> 比如Q在|页脚本中插入下面四行: console.info("q是info"); console.debug("q是debug"); console.warn("q是warn"); console.error("q是error"); 加蝲Ӟ控制C昄如下内容?/p> 可以看到Q不同性质的信息前面有不同的图标,q且每条信息后面都有链接Q点d跌{到网|码的相应行?/p> 二、占位符 console对象的上?U方法,都可以用printf风格的占位符。不q,占位W的U类比较,只支持字W(%sQ、整敎ͼ%d?iQ、QҎQ?fQ和对象Q?oQ四U?/p> 比如Q?/p> console.log("%dq?d?d?,2011,3,26); console.log("圆周率是%f",3.1415926); %o占位W,可以用来查看一个对象内部情c比如,有这样一个对象: var dog = {} ; dog.name = "大毛" ; dog.color = "黄色"; 然后Q对它用o%占位W?/p> console.log("%o",dog); 三、分l显C?/strong> 如果信息太多Q可以分l显C,用到的方法是console.group()和console.groupEnd()?/p> console.group("W一l信?); console.log("W一l第一?); console.log("W一l第二条"); console.groupEnd(); console.group("W二l信?); console.log("W二l第一?); console.log("W二l第二条"); console.groupEnd(); 点击l标题,该组信息会折叠或展开?/p> 四、console.dir() console.dir()可以昄一个对象所有的属性和Ҏ?/p> 比如Q现在ؓW二节的dog对象Q添加一个bark()Ҏ?/p> dog.bark = function(){alert("汪汪?);}; 然后Q显C对象的内容, console.dir(dog); 五、console.dirxml() console.dirxml()用来昄|页的某个节点(nodeQ所包含的html/xml代码?/p> 比如Q先获取一个表D点, var table = document.getElementById("table1"); 然后Q显C节点包含的代码?/p> console.dirxml(table); 六、console.assert() console.assert()用来判断一个表辑ּ或变量是否ؓ真。如果结果ؓ否,则在控制台输Z条相应信息,q且抛出一个异常?/p> 比如Q下面两个判断的l果都ؓ否?/p> var result = 0; console.assert( result ); var year = 2000; console.assert(year == 2011 ); 七、console.trace() console.trace()用来q踪函数的调用轨qV?/p> 比如Q有一个加法器函数?/p> function add(a,b){ return a+b; } 我想知道q个函数是如何被调用的,在其中加入console.trace()Ҏ可以了?/p> function add(a,b){ console.trace(); return a+b; } 假定q个函数的调用代码如下: var x = add3(1,1); function add3(a,b){return add2(a,b);} function add2(a,b){return add1(a,b);} function add1(a,b){return add(a,b);} q行后,会显Cadd()的调用轨q,从上C依次为add()、add1()、add2()、add3()?/p> 八、计时功?/strong> console.time()和console.timeEnd()Q用来显CZ码的q行旉?/p> console.time("计时器一"); for(var i=0;i<1000;i++){ for(var j=0;j<1000;j++){} } console.timeEnd("计时器一"); 九、性能分析 性能分析QProfilerQ就是分析程序各个部分的q行旉Q找出瓶颈所在,使用的方法是console.profile()?/p> 假定有一个函数Foo()Q里面调用了另外两个函数funcA()和funcB()Q其中funcA()调用10ơ,funcB()调用1ơ?/p> function Foo(){ for(var i=0;i<10;i++){funcA(1000);} funcB(10000); } function funcA(count){ for(var i=0;i<count;i++){} } function funcB(count){ for(var i=0;i<count;i++){} } 然后Q就可以分析Foo()的运行性能了?/p> console.profile('性能分析器一'); Foo(); console.profileEnd(); 控制C昄一张性能分析表,如下图?/p> 标题栏提C,一p行了12个函敎ͼp时2.656毫秒。其中funcA()q行10ơ,耗时1.391毫秒Q最短运行时?.123毫秒Q最?.284毫秒Q^?.139毫秒QfuncB()q行1ơ,耗时1.229ms毫秒?/p> 除了使用console.profile()ҎQfirebugq提供了一?概况"QProfilerQ按钮。第一ơ点击该按钮Q?性能分析" 开始,你可以对|页q行某种操作Q比如ajax操作Q,然后W二ơ点击该按钮Q?性能分析"l束Q该操作引发的所有运就会进行性能分析?/p> 十、属性菜?/strong> 控制台面板的名称后面Q有一个倒三角,点击后会昄属性菜单?/p> 默认情况下,控制台只昄Javascript错误。如果选中Javascript警告、CSS错误、XML错误都送上Q则相关的提CZ息都会显C?/p> q里比较有用的是"昄XMLHttpRequests"Q也是昄ajaxh。选中以后Q网늚所有ajaxhQ都会在控制台面板显C出来?/p> 比如Q点M?a target="_blank" style="color: #1a356e; text-decoration: initial;">YUICZQ控制台׃告诉我们Q它用ajax方式发出了一个GEThQhttph和响应的头信息和内容MQ也都可以看到?/p> [参考文献] * Firebug Tutorial - Logging, Profiling and CommandLine (Part I) * Firebug Tutorial - Logging, Profiling and CommandLine (Part II) Q完Q?/p> 在EXTJS官网看到一片文章,讲的是Extjs.Loader的用方法,文章非常详细的介l了 Loader的机制及用法Q感觉非怸错,但无奈英文实在太烂,没转过来。昨天恰好在CSDN看到了这文章的译文Q而译文的质量非常高,对译者的译 水^怎一个M慕了得。废话不多说Q正文开始?/p> 在开始之前,英文原文链接放上来Q英文水q高的可以看看原文哦?/p> 链接地址Q?a target="_blank" >www.sencha.com/blog/using-ext-loader-for-your-application/ ExtJS 4.0是一个用新的依赖系l的cd载系l。这两个强大的新功能允许你创建大量允许浏览器按需下蝲脚本代码的应用?/p> 今天Q我们将通过建立一个小的用新的类加蝲pȝ的应用程序来熟悉一下依赖管理系l。同Ӟ我们讨论Ext加蝲pȝ的各U配|项?/p> 在开始之前,我们先来看看要实现的结果。这样做Q可使我们确定需要扩展那些类?/p> 应用会包括互相绑定的GridPanel和FormPanelQ名U分别ؓUserGridPanel和UserFormPanel?UserGridPanel的操作需要创Z个模型和Store。UserGridPanel和UserFormPanel被渲染C个名UCؓ UserEditorWindow的窗口,它扩张自ExtJS的WindowcR所有这些类都会在命名空间MyApp下?/p> 在开始编码前Q首先要定目录l构Q以下是使用命名I间l织的文件夹Q?/p> 从上囑֏以看刎ͼMyApp目录已经按照命名I间q拆分成几个目录。在完成开发的时候,我们的应用将会有一个如下图所C的内部依赖q行模型?/p> Q?span style="font-family: 宋体; color: #ff0000">管应用的目录构成很象ExtJS 4 MVC架构Q事实上CZq没有用它 Q?/p> 现在开始编写index.html文gQ这里需要包含应用需要的启动文g和应用的Ҏ?app.js)?/p> index.html文g中需要用link标记包含ExtJS 4的样式文件。包含ext-debug.js文g的javascript标记可能要修改多ơ,ext-all-debug.js文g是开发调试用的,而ext-all.js则是在发布品时使用的?/p> q里有几个选择Q每个选择都有优缺炏V?/p> 以下是这些文件的说明Q?/p> ext-all-debug-w-comments.jsQ带注释的的完整调试版本。文件比较大Q加载时间比较长?/p> ext-all-debug.js : 不带注释的完整调试版本。文件也比较大,但很适合调试?/p> ext-all.js Q压~后的完整版本,文g比较。用该版本调试很困难,因此一般在发布产品时才使用?/p> ext-debug.js Q?该文件只包含ExtJS基础架构和空的结构。用该文gQ可以实现ExtJScL件的q程加蝲Q而且提供了很好的调试体验Q不q代h相当的慢?/p> ext.js : ext-debug.js的压~版本?/p> 我们的index.html用ext-debug.js文gQ这是实现动态加载所需的最低要求。最后,我们展C如何用ext-all版本获取最好的l果?/p> ׃UserGridPanel c要求模型和StoreQ因而,要先定义~写q些支持cR现在开始编写模型和StoreQ?/p> 以上代码扩展自Ext.data.ModelQ将创徏UserModel cR因为扩展自Ext.data.Modelc,ExtJS会自动加载它Qƈ在它加蝲后创建UserModelcR?/p> 下一步,要创建扩展自Ext.data.Store的UserStore c: 当创建单件模式的UserStore Ӟ需要在UserStore原型d一个requires关键字,它会在类实例化前QؓExtJS提供一个类的请求列表。在q个CZQ列表中只有UserModel 一个请求类?/p> Q实际上Q?在Store的原型中定义了model为UserModel c,ExtJS׃自动加蝲它。在requires关键字中列出的目的,是希望你的代码能自文档化Qself-documentingQ,从而提醒你QUserModel cL必须?Q?/p> 好了QUserGridPanel视图需要的基类已经创徏了,现在可以创徏UserGridPanelcMQ?/p> 在上面代码中Q要注意requires 关键字,看它是怎么增加UserStore 求类的。刚才,我们为GridPanel扩展和Store扩展配置了一个直接的依赖关系?/p> 下一步,我们要创建FormPanel扩展Q?/p> 因ؓUserForm 不需要从服务器端hMc,因而不需要添加requires定义?/p> 应用快完成了Q现在需要创建UserEditorWindowcdq行应用的app.js。以下是UserEditorWindowcȝ代码。因Grid和表单绑定在一P因而类代码有点长,误谅: UserEditorWindow 的代码包含了许多东西用来理UserGridPanel和UserFormPanelcȝ整个l定的声明周期。ؓ了指CExtJS在创cd加蝲q两个类Q必drequires列表里列出它们?/p> 现在完成最后一个文件app.js。ؓ了最大限度地提高我们的学习,有3ơ修改要做。首先从最单配|开始,然后逐步d?/p> 首先Qapp.js会在ExtJSdMyApp命名I间的\径,q可通过调用Ext.loader.setPathҎ实现Q方法的W?个参数是命名I间Q然后是加蝲文g与页面的相对路径?/p> 下一步,调用Ext.OnReadyҎQ传递一个包含Ext.create的匿名函数。Ext.create会在ExtJS 4.0初始化之后执行,以字W串形式传递的UserEditorWindow cM被实例化。因Z需要指向实例和希望立即昄它,因而在后面串接了showҎ的调用?/p> 如果你打开q个面Q?a >http://moduscreate.com/senchaarticles/01/pass1.html Q,你会看到UI渲染Q但很慢Qƈ且ExtJS会在Firebug中显CZ下警告信息: ExtJS提示我们没有使用加蝲pȝ最优化的方式。这是第二步要讨论的问题。然后,q是一个好的学习机会,要好好理由?/p> 我们需要配|Firebug在控制台中显CXHRhQ以便在控制C看到所有请求,而不需要切换到|络面板。这P我们不单可以观察到类依赖pȝ的工作情况,q可以从所有ExtJScd载的文g中通过qo方式扑ֈ我们要求q样的文件?/p> 在Firebug控制台过滤输入框中输?#8220;User”Q你会看C图所C的l果?/p> 我刚才提刎ͼExtJS提示了我们没有用加载系l最优化的方式。这是因Z赖是在Ext.OnReady触发加蝲之后通过同步XHRh定的,而这不是有效的方式且难于调试?/p> 未来修正q个问题Q可以修改app.js指示ExtJS先加载我们定义的c,q样卛_提供性能又便于调试: Z快速加载我们定义的cd避免调试信息Q可单的在Ext.onReady前调用Ext.requireQ只是ExtJSh UserEditorWindowcR这会让ExtJS在文档HEAD标记内注入一个script标记Q运行资源在Ext.OnReady前加载?/p> 查看http://moduscreate.com/senchaarticles/01/pass2.html 可看到它是如何工作地。在面加蝲后,你会注意到ExtJS没有在控制台昄警告信息了?/p> 我们所做的是让ExtJS框架和应用类延迟加蝲。虽然这样做调试很好Q但是对于需要快速调试的情况Q页面渲染时间会让你感到痛苦。ؓ什么? 原因很简单,因ؓq需要加载许多资源文件。在CZ中,ExtJS发送了193个Javascript资源h到web服务器,q有部分是在~存中的Q?/p> 我们创徏?个Javascript文gQ?个类文g和app.jsQ,q意味着加蝲要求的ExtJS文g?87个请求。当你在本地做开发的时候,q个Ҏ可行Q但不是最理想的和效果最好的?/p> 解决q个问题Q我们可以用折中方案,通过ext-all-debug加蝲ExtJS框架Q动态加载我们的cL件。要实现q个Q需要修改两个文件?/p> 首先Q需要修改Index.htmlQ用ext-all-debug.js替换ext.debug.js?/p> 接着Q修改app.jsQ开启Ext.LoaderQ?/p> 通过调用Loader.setConfig可开启Ext.LoaderQ需要传递一个匿名对象,它的eanbled属性设|ؓtrueQ而命名空间设|ؓ路径映射?/p> 通过~辑app.jsQ在本地开发环境下Q应用将会在1U内完成加蝲和渲染?/p> 源代码下载地址Q?a title="http://moduscreate.com/senchaarticles/01/files.zip" >http://moduscreate.com/senchaarticles/01/files.zip 译文链接地址Q?a target="_blank" >blog.csdn.net/tianxiaode/archive/2011/06/28/6571589.aspx 解析数据 XML 解析器通常情况下会处理XML文档中的所有文本?/p>
当XML元素被解析的时候,XML元素内部的文本也会被解析?/p>
下面是五个在XML文档中预定义好的实体: 一?CDATA 部g?<![CDATA[" 标记开始,?]]>"标记l束 所有在CDATA部g之间的文本都会被解析器忽略?/p>
CDATA注意事项: CDATA部g之间不能再包含CDATA部gQ不能嵌套)。如果CDATA部g包含了字W?]]>" 或?<![CDATA[" Q将很有可能出错?/p>
同样要注意在字符?]]>"之间没有I格或者换行符?/p>
解析数据 XML 解析器通常情况下会处理XML文档中的所有文本?/p>
当XML元素被解析的时候,XML元素内部的文本也会被解析?/p>
下面是五个在XML文档中预定义好的实体: 一?CDATA 部g?<![CDATA[" 标记开始,?]]>"标记l束 所有在CDATA部g之间的文本都会被解析器忽略?/p>
CDATA注意事项: CDATA部g之间不能再包含CDATA部gQ不能嵌套)。如果CDATA部g包含了字W?]]>" 或?<![CDATA[" Q将很有可能出错?/p>
同样要注意在字符?]]>"之间没有I格或者换行符?/p>
控制収ͼConsoleQ是Firebug的第一个面板,也是最重要的面板,主要作用是显C网加载过E中产生各类信息?/p>从图中可以看刎ͼUserEditorWindowcȝ一个被加蝲Q接着hUserGridPanel。UserGridPanel 要求UserStore和UserModelcR最后加载UserFormPanel cR?/p>
基本lgQ?/strong> xtype Class 描述 button Ext.Button 按钮 splitbutton Ext.SplitButton 带下拉菜单的按钮 cycle Ext.CycleButton 带下拉选项菜单的按?/td> buttongroup Ext.ButtonGroup ~组按钮(Since 3.0) slider Ext.Slider 滑动?/td> progress Ext.ProgressBar q度?/td> statusbar Ext.StatusBar 状态条Q?.2加进来,3.0 又去?/td> colorpalette Ext.ColorPalette 调色?/td> datepicker Ext.DatePicker 日期选择面板 容器及数据类lg xtype Class 描述 window Ext.Window H口 viewport Ext.ViewPort 视口Q即览器的视口Q能随之伸羃 box Ext.BoxComponent 盒子lgQ相当于一?<div> component Ext.Component lg container Ext.Container 容器 panel Ext.Panel 面板 tabpanel Ext.TabPanel 选项面板 treepanel Ext.tree.TreePanel 树型面板 flash Ext.FlashComponent 昄 Flash 的组?Since 3.0) grid Ext.grid.GridPanel 表格 editorgrid Ext.grid.EditorGridPanel 可编辑的表格 propertygrid Ext.grid.PropertyGrid 属性表?/td> editor Ext.Editor ~辑?/td> dataview Ext.DataView 数据昄视图 listview Ext.ListView 列表视图 工具栏组Ӟ xtype Class 描述 paging Ext.PagingToolbar 分页工具?/td> toolbar Ext.Toolbar 工具?/td> tbbutton Ext.Toolbar.Button 工具栏按?/td> tbfill Ext.Toolbar.Fill 工具栏填充区 tbitem Ext.Toolbar.Item 工具条项?/td> tbseparator Ext.Toolbar.Separator 工具栏分隔符 tbspacer Ext.Toolbar.Spacer 工具栏空?/td> tbsplit Ext.Toolbar.SplitButton 工具栏分隔按?/td> tbtext Ext.Toolbar.TextItem 工具栏文本项 菜单lgQ?/td> xtype Class 描述 menu Ext.menu.Menu 菜单 colormenu Ext.menu.ColorMenu 颜色选择菜单 datemenu Ext.menu.DateMenu 日期选择菜单 menubaseitem BaseItem menucheckitem Ext.menu.CheckItem 选项菜单?/td> menuitem Ext.menu.Item menuseparator Ext.menu.Separator 菜单分隔U?/td> menutextitem Ext.menu.TextItem 文本菜单?/td> 表单及表单域lgQ?/td> xtype Class 描述 form Ext.FormPanel/Ext.form.FormPanel 表单面板 checkbox Ext.form.Checkbox 多选框 combo Ext.form.ComboBox 下拉?/td> datefield Ext.form.DateField 日期选择?/td> timefield Ext.form.TimeField 旉录入?/td> field Ext.form.Field 表单字段 fieldset Ext.form.FieldSet 表单字段l?/td> hidden Ext.form.Hidden 表单隐藏?/td> htmleditor Ext.form.HtmlEditor HTML ~辑?/td> label Ext.form.Label 标签 numberfield Ext.form.NumberField 数字~辑?/td> radio Ext.form.Radio 单选按?/td> textarea Ext.form.TextArea 多行文本?/td> textfield Ext.form.TextField 表单文本?/td> trigger Ext.form.TriggerField 触发录入?/td> checkboxgroup Ext.form.CheckboxGroup ~组的多选框(Since 2.2) displayfield Ext.form.DisplayField 仅显C,不校?不被提交的文本框 radiogroup Ext.form.RadioGroup ~组的单选按?Since 2.2) 图表lgQ?/td> xtype Class 描述 chart Ext.chart.Chart 图表lg barchart Ext.chart.BarChart q?/td> cartsianchart Ext.chart.CartesianChart columnchart Ext.chart.ColumnChart linechart Ext.chart.LineChart q线?/td> piechart Ext.chart.PieChart 扇Ş?/td> 数据?StoreQ?/td> xtype Class 描述 arraystore Ext.data.ArrayStore directstore Ext.data.DirectStore groupingstore Ext.data.GroupingStore jsonstore Ext.data.JsonStore simplestore Ext.data.SimpleStore store Ext.data.Store xmlstore Ext.data.XmlStore 如果文本中含?#8220;<”Q?#8220;>”{特D的字符时将会出现异常。(当含?#8220;Q?#8221;ӞDataSet.ReadXml也会出现异常Q?/pre>
一U解x法是Q用实体&来表C?/pre>
<
<
于?/td>
>
>
大于?/td>
&
&
?/td>
'
'
单引?/td>
"
"
双引?/td>
另一U解x法是使用CDATA部gQ?/pre>
如果文本中含?#8220;<”Q?#8220;>”{特D的字符时将会出现异常。(当含?#8220;Q?#8221;ӞDataSet.ReadXml也会出现异常Q?/pre>
一U解x法是Q用实体&来表C?/pre>
<
<
于?/td>
>
>
大于?/td>
&
&
?/td>
'
'
单引?/td>
"
"
双引?/td>
另一U解x法是使用CDATA部gQ?/pre>
需要在用户把光标移到某个元素上时显CZ些额外信息时Q提C框是一U不错的方式Q提C框会在鼠标停留的时候显C,鼠标Ud时消失?/p>
适当的用提C框能大大提升网站的友好度,q且可以节省一些不必要的网늩_今天我们看?5Ƒֈ作友好的提示框的jQuery插g?/p>
qTip是一Ƒ֊能高U的提示框插Ӟ它提供了非常多的Ҏ,包括圆角框、提C泡等?br />
q个提示框插件能够显CZQ何的HTML元素Q比如链接、表根{表单、图片,实现q些效果是很L的,你也可以L制作q牚w格的提示框?img class="alignnone size-full wp-image-585" title="jquery-tools-tooltips" alt="jquery-tools-tooltips" src="http://www.webdesignbooth.com/wp-content/uploads/2009/06/jquery-tools-tooltips.png" width="500" height="132" />
Simpletip 允许你通过Jquery的元素选择器和事g理器轻村֜M元素上制作提C框Q提C框可以佉K态的、动态的、甚臛_以通过ajax加蝲Qƈ且都有非常多不懂的显C效果?/p>
jQuery (mb)Tooltip是一N过 jQuery timers 和半透明阴媄插g实现的漂亮的提示框插Ӟ它ؓ各种需求提供很多可选项?/p>
5. EZPZ Tooltip
你不需要添加Q何CSS或图片就可以扩展、定制提C框的样式风根{?/p>
q个插g在表单右Ҏ供一个自动变化的提示框,当输入框获得焦点时它׃昄Q失ȝҎ隐藏?img class="alignnone size-full wp-image-588" title="iquery-input-floating-hint-box" alt="iquery-input-floating-hint-box" src="http://www.webdesignbooth.com/wp-content/uploads/2009/06/iquery-input-floating-hint-box.png" width="465" height="150" />
你可以用 Orbital Tooltip在目标元素的360°M一个位|制作出一个提C框?
Facebook风格的提C框插g?br />
div的样式如下:
width:300px;
height:200px;
padding:10px;
border:10px solid #ccc;
background:#eee;
font-size:12px;
则:
IE6.0、FF1.06+Q?/strong>
clientWidth = width + padding = 300+10×2 = 320
clientHeight = height + padding = 200+10×2 = 220
offsetWidth = width + padding + border = 300+10×2+10×2= 340
offsetHeight = height + padding + border = 200+10×2+10×2 = 240
IE5.0/5.5Q?/strong>
clientWidth = width - border = 300-10×2 = 280
clientHeight = height - border = 200-10×2 = 180
offsetWidth = width = 300
offsetHeight = height = 200
Ҏ属?font face="Times New Roman">(border)用来讑֮一个元素的边线?/font>
边距属?font face="Times New Roman">(margin)是用来设|一个元素所占空间的边缘到相d素之间的距离?/font>
间隙属?font face="Times New Roman">(padding)是用来设|元素内容到元素边界的距R?/font>
q三个属性都属于CSS?/font>boxcd的属性?/font>
下面q个C意图,很Ş象地体现了三者之间的区别?/span>
q里提供一张盒模型?font face="Times New Roman">3DC意图,希望便于你的理解和记忆?/font>
|页可见区域宽:document.body.clientWidth
|页可见区域高:document.body.clientHeight
|页可见区域宽:document.body.offsetWidth (包括边线的宽)
|页可见区域高:document.body.offsetHeight (包括边线的宽)
|页正文全文宽:document.body.scrollWidth
|页正文全文高:document.body.scrollHeight
|页被卷ȝ高:document.body.scrollTop
|页被卷ȝ左:document.body.scrollLeft
|页正文部分上:window.screenTop
|页正文部分左:window.screenLeft
屏幕分L率的高:window.screen.height
屏幕分L率的宽:window.screen.width
屏幕可用工作区高度:window.screen.availHeight
屏幕可用工作区宽度:window.screen.availWidth
Header 1 | Header 2 | Header 3 | Header 4 | |||
---|---|---|---|---|---|---|
Cell Content 1 | Cell Content 2 | Cell Content 3 | Cell Content 4 | |||
More Cell Content 1 | More Cell Content 2 | More Cell Content 3 | More Cell Content 4 | |||
Even More Cell Content 1 | Even More Cell Content 2 | Even More Cell Content 3 | Even More Cell Content 4 | |||
And Repeat 1 | And Repeat 2 | And Repeat 3 | And Repeat 4 | |||
And Repeat 1 | And Repeat 2 | And Repeat 3 | And Repeat 4 | |||
And Repeat 1 | And Repeat 2 | And Repeat 3 | And Repeat 4 | |||
And Repeat 1 | And Repeat 2 | And Repeat 3 | And Repeat 4 | |||
And Repeat 1 | And Repeat 2 | And Repeat 3 | And Repeat 4 | |||
And Repeat 1 | And Repeat 2 | And Repeat 3 | And Repeat 4 | |||
And Repeat 1 | And Repeat 2 | And Repeat 3 | And Repeat 4 | |||
And Repeat 1 | And Repeat 2 | And Repeat 3 | And Repeat 4 | |||
And Repeat 1 | And Repeat 2 | And Repeat 3 | And Repeat 4 | |||
And Repeat 1 | And Repeat 2 | And Repeat 3 | And Repeat 4 | |||
And Repeat 1 | And Repeat 2 | And Repeat 3 | And Repeat 4 | |||
And Repeat 1 | And Repeat 2 | And Repeat 3 | And Repeat 4 | |||
And Repeat 1 | And Repeat 2 | And Repeat 3 | And Repeat 4 | |||
And Repeat 1 | And Repeat 2 | And Repeat 3 | And Repeat 4 | |||
And Repeat 1 | And Repeat 2 | And Repeat 3 | And Repeat 4 | |||
And Repeat 1 | And Repeat 2 | And Repeat 3 | 最?7 | |||
合计: | 10000 |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
<style type="text/css">
<!--
body {
background: #FFF;
color: #000;
font: normal normal 12px Verdana, Geneva, Arial, Helvetica, sans-serif;
margin: 10px;
padding: 0
}
table, td, a {
color: #000;
font: normal normal 12px Verdana, Geneva, Arial, Helvetica, sans-serif
}
.td
{
nowrap:’’true’’;
}
div.tableContainer {
clear: both;
border: 1px solid #963;
height: 285px;
overflow: auto;
width: 100%;
}
/* WinIE 6.x needs to re-account for it’’s scrollbar. Give it some padding */
\html div.tableContainer/* */ {
padding: 0 16px 0 0
}
/* clean up for allowing display Opera 5.x/6.x and MacIE 5.x */
html>body div.tableContainer {
height: auto;
padding: 0;
width: 740px
}
/* Reset overflow value to hidden for all non-IE browsers. */
/* Filter out Opera 5.x/6.x and MacIE 5.x */
head:first-child+body div[class].tableContainer {
height: 285px;
overflow: hidden;
width: 756px
}
/* define width of table. IE browsers only */
/* if width is set to 100%, you can remove the width */
/* property from div.tableContainer and have the div scale */
div.tableContainer table {
float: left;
width: 100%
}
/* WinIE 6.x needs to re-account for padding. Give it a negative margin */
\html div.tableContainer table/* */ {
margin: 0 -16px 0 0
}
/* define width of table. Opera 5.x/6.x and MacIE 5.x */
html>body div.tableContainer table {
float: none;
margin: 0;
width: 740px
}
/* define width of table. Add 16px to width for scrollbar. */
/* All other non-IE browsers. Filter out Opera 5.x/6.x and MacIE 5.x */
head:first-child+body div[class].tableContainer table {
width: 756px
}
/* set table header to a fixed position. WinIE 6.x only */
/* In WinIE 6.x, any element with a position property set to relative and is a child of */
/* an element that has an overflow property set, the relative value translates into fixed. */
/* Ex: parent element DIV with a class of tableContainer has an overflow property set to auto */
thead.fixedHeader tr {
position: relative;
/* expression is for WinIE 5.x only. Remove to validate and for pure CSS solution */
top: expression(document.getElementById("tableContainer").scrollTop)
}
thead.fixedHeader2 tr {
position: relative;
/* expression is for WinIE 5.x only. Remove to validate and for pure CSS solution */
bottom: expression(document.getElementById("tableContainer").scrollHeight > document.getElementById("tableContainer").clientHeight ? document.getElementById("tableContainer").scrollHeight - document.getElementById("tableContainer").scrollTop - document.getElementById("tableContainer").clientHeight :0)
}
/* set THEAD element to have block level attributes. All other non-IE browsers */
/* this enables overflow to work on TBODY element. All other non-IE, non-Mozilla browsers */
/* Filter out Opera 5.x/6.x and MacIE 5.x */
head:first-child+body thead[class].fixedHeader tr {
display: block
}
/* make the TH elements pretty */
thead.fixedHeader th {
background: #C96;
border-left: 1px solid #EB8;
border-right: 1px solid #B74;
border-top: 1px solid #EB8;
font-weight: normal;
padding: 4px 3px;
text-align: center
}
/* make the TH elements pretty */
thead.fixedHeader2 th {
background: #C96;
border-left: 1px solid #EB8;
border-right: 1px solid #B74;
border-top: 1px solid #EB8;
font-weight: normal;
padding: 4px 3px;
text-align: left
}
/* make the A elements pretty. makes for nice clickable headers */
thead.fixedHeader a, thead.fixedHeader a:link, thead.fixedHeader a:visited {
color: #FFF;
display: block;
text-decoration: none;
width: 100%
}
thead.fixedHeader2 a, thead.fixedHeader2 a:link, thead.fixedHeader a:visited {
color: #FFF;
display: block;
text-decoration: none;
width: 100%
}
/* make the A elements pretty. makes for nice clickable headers */
/* WARNING: swapping the background on hover may cause problems in WinIE 6.x */
thead.fixedHeader a:hover {
color: #FFF;
display: block;
text-decoration: underline;
width: 100%
}
/* define the table content to be scrollable */
/* set TBODY element to have block level attributes. All other non-IE browsers */
/* this enables overflow to work on TBODY element. All other non-IE, non-Mozilla browsers */
/* induced side effect is that child TDs no longer accept width: auto */
/* Filter out Opera 5.x/6.x and MacIE 5.x */
head:first-child+body tbody[class].scrollContent {
display: block;
height: 262px;
overflow: auto;
width: 100%
}
/* make TD elements pretty. Provide alternating classes for striping the table */
/* http://www.alistapart.com/articles/zebratables/ */
tbody.scrollContent td, tbody.scrollContent tr.normalRow td {
background: #FFF;
border-bottom: 1px solid #EEE;
border-left: 1px solid #EEE;
border-right: 1px solid #AAA;
border-top: 1px solid #AAA;
padding: 2px 3px
}
tbody.scrollContent tr.alternateRow td {
background: #EEE;
border-bottom: 1px solid #EEE;
border-left: 1px solid #EEE;
border-right: 1px solid #AAA;
border-top: 1px solid #AAA;
padding: 2px 3px
}
/* define width of TH elements: 1st, 2nd, and 3rd respectively. */
/* All other non-IE browsers. Filter out Opera 5.x/6.x and MacIE 5.x */
/* Add 16px to last TH for scrollbar padding */
/* http://www.w3.org/TR/REC-CSS2/selector.html#adjacent-selectors */
head:first-child+body thead[class].fixedHeader th {
width: 200px
}
head:first-child+body thead[class].fixedHeader th + th {
width: 250px
}
head:first-child+body thead[class].fixedHeader th + th + th {
border-right: none;
padding: 4px 4px 4px 3px;
width: 316px
}
/* define width of TH elements: 1st, 2nd, and 3rd respectively. */
/* All other non-IE browsers. Filter out Opera 5.x/6.x and MacIE 5.x */
/* Add 16px to last TH for scrollbar padding */
/* http://www.w3.org/TR/REC-CSS2/selector.html#adjacent-selectors */
head:first-child+body tbody[class].scrollContent td {
width: 200px
}
head:first-child+body tbody[class].scrollContent td + td {
width: 250px
}
head:first-child+body tbody[class].scrollContent td + td + td {
border-right: none;
padding: 2px 4px 2px 3px;
width: 300px
/* expression is for WinIE 5.x only. Remove to validate and for pure CSS solution */
top: expression(document.getElementById("tableContainer").scrollTop)
}
-->
</style>
</head><body>
<script>
function test() {
var cH = document.getElementById("tableContainer").clientHeight;
var sH = document.getElementById("tableContainer").scrollHeight;
var sT = document.getElementById("tableContainer").scrollTop;
alert(cH+":"+sH+":"+sT);
}
</script>
<div id="tableContainer" class="tableContainer">
<table border="0" cellpadding="0" cellspacing="0" width="100%" class="scrollTable">
<thead class="fixedHeader">
<tr>
<th><a href="#" onclick="javascript:test();">Header 1</a></th>
<th><a href="#">Header 2</a></th>
<th><a href="#">Header 3</a></th>
<th><a href="#">Header 4</a></th>
</tr>
</thead>
<tbody class="scrollContent">
<tr>
<td>Cell Content 1</td>
<td>Cell Content 2</td>
<td>Cell Content 3</td>
<td>Cell Content 4</td>
</tr>
<tr>
<td>More Cell Content 1</td>
<td>More Cell Content 2</td>
<td>More Cell Content 3</td>
<td>More Cell Content 4</td>
</tr>
<tr>
<td nowrap>Even More Cell Content 1</td>
<td nowrap>Even More Cell Content 2</td>
<td nowrap>Even More Cell Content 3</td>
<td nowrap>Even More Cell Content 4</td>
</tr>
<tr>
<td>And Repeat 1</td>
<td>And Repeat 2</td>
<td>And Repeat 3</td>
<td>And Repeat 4</td>
</tr>
<tr>
<td>And Repeat 1</td>
<td>And Repeat 2</td>
<td>And Repeat 3</td>
<td>And Repeat 4</td>
</tr>
<tr>
<td>And Repeat 1</td>
<td>And Repeat 2</td>
<td>And Repeat 3</td>
<td>And Repeat 4</td>
</tr>
<tr>
<td>And Repeat 1</td>
<td>And Repeat 2</td>
<td>And Repeat 3</td>
<td>And Repeat 4</td>
</tr>
<tr>
<td>And Repeat 1</td>
<td>And Repeat 2</td>
<td>And Repeat 3</td>
<td>And Repeat 4</td>
</tr>
<tr>
<td>And Repeat 1</td>
<td>And Repeat 2</td>
<td>And Repeat 3</td>
<td>And Repeat 4</td>
</tr>
<tr>
<td>And Repeat 1</td>
<td>And Repeat 2</td>
<td>And Repeat 3</td>
<td>And Repeat 4</td>
</tr>
<tr>
<td>And Repeat 1</td>
<td>And Repeat 2</td>
<td>And Repeat 3</td>
<td>And Repeat 4</td>
</tr>
<tr>
<td>And Repeat 1</td>
<td>And Repeat 2</td>
<td>And Repeat 3</td>
<td>And Repeat 4</td>
</tr>
<tr>
<td>And Repeat 1</td>
<td>And Repeat 2</td>
<td>And Repeat 3</td>
<td>And Repeat 4</td>
</tr>
<tr>
<td>And Repeat 1</td>
<td>And Repeat 2</td>
<td>And Repeat 3</td>
<td>And Repeat 4</td>
</tr>
<tr>
<td>And Repeat 1</td>
<td>And Repeat 2</td>
<td>And Repeat 3</td>
<td>And Repeat 4</td>
</tr>
<tr>
<td>And Repeat 1</td>
<td>And Repeat 2</td>
<td>And Repeat 3</td>
<td>And Repeat 4</td>
</tr>
<tr>
<td>And Repeat 1</td>
<td>And Repeat 2</td>
<td>And Repeat 3</td>
<td>And Repeat 4</td>
</tr>
<tr>
<td>And Repeat 1</td>
<td>And Repeat 2</td>
<td>And Repeat 3</td>
<td>And Repeat 4</td>
</tr>
<tr>
<td>And Repeat 1</td>
<td>And Repeat 2</td>
<td>And Repeat 3</td>
<td>最?7</td>
</tr>
</tbody>
<thead class="fixedHeader2">
<tr>
<th><a href="#">合计:</a></th>
<th colspan=6><a href="#">10000</a></th>
</tr>
</thead>
</table>
</div>
</body></html>
iframeObj.id = thisObj.name+"_suggest_iframe";
iframeObj.name = thisObj.name+"_suggest_iframe";
document.body.appendChild(iframeObj);
if (isNull(divObj)) {
divObj = document.createElement("DIV");
}
divObj.name = thisObj.name+"_suggest";
divObj.id = thisObj.name+"_suggest";
divObj.style.border = '1px';
divObj.isOut = "true";
divObj.onmouseover = "javascript:this.isOut = 'false'";
divObj.onmouseout = "javascript:this.isOut = 'true'";
divObj.style.cursor = "hand";
document.body.appendChild(divObj);
divObj.style.position = "absolute";
ajax.setResponseFun(function(){
var dom = ajax.getDomDoc();
if(dom.readyState == 4) {
var root = dom.documentElement;
var str = "";
if (root.childNodes.length == 0) {
document.body.onclick();
return true;
}
for(var i = 0; i < root.childNodes.length; i++) {
str+="<div onmouseover='javascript:suggestOver(this);'";
str+=" onmouseout='javascript:suggestOut(this);' ";
str+=" onclick='javascript:setSearch(this.innerHTML,\""+thisObj.name+"\");' class='td-across-low' style='background-color:white;'>";
str+=root.childNodes[i].text+"</div>";
}
divObj.innerHTML = str;
divObj.style.borderBottom = '0.008cm outset ';
divObj.style.borderRight = '0.008cm outset ';
divObj.style.borderTop = '0.008cm outset ';
divObj.style.borderLeft = '0.008cm outset ';
divObj.style.overflowY = "auto";
divObj.style.height = divObj.offsetHeight > 300 ? 300 : divObj.offsetHeight;
var oRect = thisObj.getBoundingClientRect();
divObj.style.left = oRect.left;
divObj.style.top = oRect.top + 18;
divObj.style.width = thisObj.clientWidth+2;
try {
var iobj = document.getElementById(thisObj.name+"_suggest_iframe");
iobj.style.position = "absolute";
iobj.style.left = divObj.offsetLeft;
iobj.style.top = divObj.offsetTop;
iobj.style.height = divObj.offsetHeight;
iobj.style.width = divObj.offsetWidth;
} catch(e){}
}
});
ajax.send();
return true;
}
function suggestOver(obj) {
for(var i = 0; i < obj.parentNode.childNodes.length; i++) {
obj.parentNode.childNodes[i].className = "td-across-low";
obj.parentNode.childNodes[i].style.backgroundColor = "white";
}
obj.className = "td-across-deep";
obj.style.backgroundColor = "";
}
function suggestOut(obj) {
obj.className = "td-across-low";
obj.style.backgroundColor = "white";
}
function setSearch(value,thisObjName) {
document.all[thisObjName].value = value;
try {
document.body.removeChild(document.getElementById(thisObjName+"_suggest_iframe"));
document.body.removeChild(document.getElementById(thisObjName+"_suggest"));
} catch (e){}
}
function hideSuggest(thisObj) {
var obj = document.getElementById(thisObj.name+"_suggest");
if ( isNull(obj) ) {
return true;
} else {
if (obj.isOut == "true") {
document.body.removeChild(document.getElementById(obj.name+"_suggest_iframe"));
document.body.removeChild(obj);
}
}
return true;
}
var menuOpen = false;
function openMemo(){
var obj = document.getElementById('frameaaa');
if(!menuOpen) {
obj.src = "XXX/XXX.html";
obj.style.display="block";
menuOpen = true;
try {
obj.onreadystatechange = function() {obj.fireEvent('onload');}
} catch(e) {}
}
}
如果没有onreadystatechangeQ小文g是适合的,大文件就不行?/p>
/**
* CMsnMsg对象的显C方?br>*/
CMsnMsg.prototype.show = function() {
var pop = window.createPopup();
this.pop = pop;
var str = "<DIV style='BORDER-RIGHT: #455690 1px solid; BORDER-TOP: #a6b4cf 1px solid; Z-INDEX: 99999; LEFT: 0px; BORDER-LEFT: #a6b4cf 1px solid; WIDTH: "
str +=this.width + "px; BORDER-BOTTOM: #455690 1px solid; POSITION: absolute; TOP: 0px; HEIGHT: " + this.height + "px; BACKGROUND-COLOR: #c9d3f3'>"
str += "<TABLE style='BORDER-TOP: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid' cellSpacing=0 cellPadding=0 width='100%' bgColor=#cfdef4 border=0>"
str += "<TR>"
str += "<TD style='FONT-SIZE: 12px;COLOR: #0f2c8c' width=30 height=24></TD>"
str += "<TD style='PADDING-LEFT: 4px; FONT-WEIGHT: normal; FONT-SIZE: 12px; COLOR: #1f336b; PADDING-TOP: 4px' vAlign=center width='100%'>" + this.title + "</TD>"
str += "<TD style='PADDING-RIGHT: 2px; PADDING-TOP: 2px' vAlign=center align=right width=19>"
str += "<SPAN title=关闭 style='FONT-WEIGHT: bold; FONT-SIZE: 12px; CURSOR: hand; COLOR: black; MARGIN-RIGHT: 4px' id='btSysClose' >×</SPAN></TD>"
str += "</TR>"
str += "<TR>"
str += "<TD style='PADDING-RIGHT: 1px;PADDING-BOTTOM: 1px' colSpan=3 height=" + (this.height-28) + ">"
str += "<DIV style='BORDER-RIGHT: #b9c9ef 1px solid; PADDING-RIGHT: 8px; BORDER-TOP: #728eb8 1px solid; PADDING-LEFT: 8px; FONT-SIZE: 12px; PADDING-BOTTOM: 8px;";
str += "BORDER-LEFT: #728eb8 1px solid; WIDTH: 100%; COLOR: #1f336b; PADDING-TOP: 8px; BORDER-BOTTOM: #b9c9ef 1px solid; HEIGHT: 100%'>"
str += this.innerHTML;
str += "</DIV>"
str += "</TD>"
str += "</TR>"
str += "</TABLE>"
str += "</DIV>"
pop.document.body.innerHTML = str;
this.offset = 0;
var me = this;
pop.document.body.onmouseover = function() {me.pause = true;};
pop.document.body.onmouseout = function() {me.pause = false;};
var fun = function() {
var x = me.left;
var y = 0;
var width = me.width;
var height = me.height;
if (me.offset > me.height) {
height = me.height;
} else {
height = me.offset;
}
y = me.bottom - me.offset;
if (y <= me.top) {
me.timeout -= 1;
if (me.timeout == 0) {
window.clearInterval(me.timer);
if (me.autoHide) {
me.hide();
}
}
} else {
me.offset += me.step;
}
me.pop.show(x,y,width,height);
}
this.timer = window.setInterval(fun,this.speed);
var btClose = pop.document.getElementById("btSysClose");
btClose.onclick = function(){
me.close = true;
me.hide();
}
}
/**
* CMsnMsg对象的关闭方?br>*/
CMsnMsg.prototype.hide = function() {
flag = true;
var offset = this.height>this.bottom-this.top?this.height:this.bottom-this.top;
var me = this;
if(this.timer > 0){
window.clearInterval(me.timer);
}
var fun = function() {
if (!me.pause || me.close) {
var x = me.left;
var y = 0;
var width = me.width;
var height = 0;
if (me.offset > 0) {
height = me.offset;
}
y = me.bottom - height;
if (y >= me.bottom) {
window.clearInterval(me.timer);
me.pop.hide();
} else {
me.offset -= me.step;
}
me.pop.show(x,y,width,height);
}
}
this.timer = window.setInterval(fun,this.speed);
}
var msg = null;
function test() {
if (msg == null || !msg.pause) {
msg = new CMsnMsg(300,220,"ABMpȝ提示");
msg.innerHTML = "<A href='www.baidu.com'>www.baidu.com</a>"
msg.show();
}
}
window.setInterval("test();",20000);