百度空间 | 百度首页 
 
文章列表
 
您正在查看 "网页技术" 分类下的文章

2008-03-14 15:41

怎么去取得或者控制不同iframe里面的控件?
iframe A
iframe V
在A中控制V中的textbox

以前还真没这么操作过,但是感觉应该没问题,幸亏ff里有firebug这么好的插件,Watch一下就能看到相关属性了,发现contentWindow估计就是他了,然后watch一下,果然是我想要的

parent.document.getElementById("RightFrame").contentWindow.document就是相当于在本页面的document了,想怎么取就怎么取了,关键是要知道contentWindow这个属性

类别:网页技术 | 评论(1) | 浏览()
 
2008-01-09 11:27
在浏览器中地址栏中输入:javascript:document.body.contentEditable='true'; document.designMode='on'; void 0
回车即可
类别:网页技术 | 评论(1) | 浏览()
 
2007-09-10 15:31
function HideSelect(){
    var items = document.all.tags('SELECT');
    var l=document.all.tags('SELECT').length;
    for(var i=0;i<l;i++){
        items[i].style.display='none';
    }
}
function ShowSelect(){
    var items = document.all.tags('SELECT');
    var l=document.all.tags('SELECT').length;
    for(var i=0;i<l;i++){
        items[i].style.display='';
    }
}

在相应的地方调用这两个函数即可。
类别:网页技术 | 评论(0) | 浏览()
 
2007-08-08 15:48
<textarea rows="10" cols="100" id="test1">asdf&nbsp;&amp;&#13;&#10;asdf</textarea>

原来&#ASCII 码; 就可以表示ASCII 码 了
类别:网页技术 | 评论(0) | 浏览()
 
2007-08-08 11:40
经常会用到隐藏span

当点击某个链接或者按钮之后把span显示出来,并且位置是相对于那个链接或者按钮的

往往会采用设置span的样式为:

display: none; position: absolute; margin-left:-220px;;margin-top: 20px; z-index: 999;

但是在ff下就不会像ie那样的效果,ff的默认浮动和ie不同,所以span的位置就不一样了

解决的方法是在span上再嵌一层父span,给他的float:left 就可以了。
类别:网页技术 | 评论(0) | 浏览()
 
2007-08-08 11:07
1 针对firefox ie6 ie7的css样式
现在大部分都是用!important来hack,对于ie6和firefox测试可以正常显示,
但是ie7对!important可以正确解释,会导致页面没按要求显示!找到一个针
对IE7不错的hack方式就是使用“*+html”,现在用IE7浏览一下,应该没有问题了。
现在写一个CSS可以这样:

#1 { color: #333; } /* Moz */
* html #1 { color: #666; } /* IE6 */
*+html #1 { color: #999; } /* IE7 */
那么在firefox下字体颜色显示为#333,IE6下字体颜色显示为#666,IE7下字体颜色显示为#999。

2 css布局中的居中问题
主要的样式定义如下:

body {TEXT-ALIGN: center;}
#center { MARGIN-RIGHT: auto; MARGIN-LEFT: auto; }
说明:
首先在父级元素定义TEXT-ALIGN: center;这个的意思就是在父级元素内的内容居中;对于IE这样设定就已经可以了。
但在mozilla中不能居中。解决办法就是在子元素定义时候设定时再加上“MARGIN-RIGHT: auto;MARGIN-LEFT: auto; ”
需要说明的是,如果你想用这个方法使整个页面要居中,建议不要套在一个DIV里,你可以依次拆出多个div,
只要在每个拆出的div里定义MARGIN-RIGHT: auto;MARGIN-LEFT: auto; 就可以了。

3   盒模型不同解释.

#box{    width:600px;         //for    ie6.0-    w\idth:500px;        //for   ff+ie6.0}
#box{     width:600px!important             //for ff     width:600px;         //for   ff+ie6.0     width /**/:500px;        //for    ie6.0-}

4 浮动ie产生的双倍距离

#box{    float:left;    width:100px;    margin:0 0 0 100px;   //这种情况之下IE会产生200px的距离    display:inline;    //使浮动忽略}
这里细说一下block,inline两个元素,Block元素的特点是:总是在新行上开始,高度,宽度,行高,边距都可以控制(块元素);Inline元素的特点是:和其他元素在同一行上,...不可控制(内嵌元素);

#box{    display:block; //可以为内嵌元素模拟为块元素    display:inline; //实现同一行排列的的效果    diplay:table;

5 IE与宽度和高度的问题

IE不认得min-这个定义,但实际上它把正常的width和height当作有min的情况来使。这样问题就大了,如果只用宽度和高度,
正常的浏览器里这两个值就不会变,如果只用min-width和min-height的话,IE下面根本等于没有设置宽度和高度。
比如要设置背景图片,这个宽度是比较重要的。要解决这个问题,可以这样:
#box{     width: 80px;     height: 35px;}html>body #box{     width: auto;     height: auto;     min-width: 80px;     min-height: 35px;}

6 页面的最小宽度

min-width是个非常方便的CSS命令,它可以指定元素最小也不能小于某个宽度,这样就能保证排版一直正确。但IE不认得这个,
而它实际上把width当做最小宽度来使。为了让这一命令在IE上也能用,可以把一个<div> 放到 <body> 标签下,然后为div指定一个类:
然后CSS这样设计:
#container{   min-width: 600px;   width:expression(document.body.clientWidth < 600? "600px": "auto" );}
第一个min-width是正常的;但第2行的width使用了Javascript,这只有IE才认得,这也会让你的HTML文档不太正规。它实际上通过Javascript的判断来实现最小宽度。

7 清除浮动

.hackbox{        display:table; //将对象作为块元素级的表格显示}或者.hackbox{         clear:both;}
或者加入:after(伪对象),设置在对象后发生的内容,通常和content配合使用,IE不支持此伪对象,非Ie 浏览器支持,
所 以并不影响到IE/WIN浏览器。这种的最麻烦的......#box:after{     content: ".";      display: block;     height: 0;      clear: both;      visibility: hidden;}

8 DIV浮动IE文本产生3象素的bug

左边对象浮动,右边采用外补丁的左边距来定位,右边对象内的文本会离左边有3px的间距.

#box{     float:left;     width:800px;}#left{     float:left;     width:50%;}#right{     width:50%;}*html #left{     margin-right:-3px;    //这句是关键}
    HTML代码<div id="box">     <div id="left"></div>    <div id="right"></div></div>

9 属性选择器(这个不能算是兼容,是隐藏css的一个bug

p[id]{}div[id]{}
这个对于IE6.0和IE6.0以下的版本都隐藏,FF和OPera作用
属性选择器和子选择器还是有区别的,子选择器的范围从形式来说缩小了,属性选择器的范围比较大,如p[id]中,所有p标签中有id的都是同样式的.

10 IE捉迷藏的问题
    
    当div应用复杂的时候每个栏中又有一些链接,DIV等这个时候容易发生捉迷藏的问题。
有些内容显示不出来,当鼠标选择这个区域是发现内容确实在页面。
解决办法:对#layout使用line-height属性 或者给#layout使用固定高和宽。页面结构尽量简单。

11 高度不适应
     
     高度不适应是当内层对象的高度发生变化时外层高度不能自动进行调节,特别是当内层对象使用
margin 或paddign 时。
例:
    <div id="box">
      <p>p对象中的内容</p>
    </div>
CSS:#box {background-color:#eee; }       
#box p {margin-top: 20px;margin-bottom: 20px; text-align:center; }
解决方法:在P对象上下各加2个空的div对象CSS代码:.1{height:0px;overflow:hidden;}或者为DIV加上border属性。
类别:网页技术 | 评论(0) | 浏览()
 
2007-07-31 11:27
var labels=window.prompt("Apply Labels","");

if(labels)...{}
类别:网页技术 | 评论(0) | 浏览()
 
2007-01-03 23:06
1。表空间使用情况:
select a.id, a.indid, a.minlen 单行最短占用, a.xmaxlen 单行最长占用, b.name 对象名, rowcnt 行数, dpages*8 数据使用空间, used*8 使用空间, reserved*8 占用空间, a.rowmodctr 更新统计后变化行数 from sysindexes a(nolock) , sysobjects b(nolock) where a.id = b.id and b.xtype = 'u' and indid in (0, 1) order by 使用空间 desc

2。消除xp_cmdshell,防止黑客攻击

Use Master
   Exec sp_dropextendedproc N'xp_cmdshell' 
   Go
如果再需要,可以这样恢复
Use Master
   Exec sp_addextendedproc N'xp_cmdshell', N'xplog70.dll' 
   Go

3。清空日志
执行 DUMP  TRANSACTION  库名  WITH  NO_LOG再压缩即可

为了以后能自动收缩,做如下设置:
企业管理器--服务器--右键数据库--属性--选项--选择"自动收缩"

如果想以后不让它日志增长得太大:
企业管理器--服务器--右键数据库--属性--事务日志
  --将文件增长限制为xM(x是你允许的最大数据文件大小)
类别:网页技术 | 评论(1) | 浏览()
 
2006-09-11 17:31

  var colProcesses = wmi.ExecQuery(wmiq);

 var e = new Enumerator(colProcesses);
  for (; !e.atEnd(); e.moveNext()) {
     var x = e.item();
     x.Terminate(1);
  }

 

类别:网页技术 | 评论(0) | 浏览()
 
2006-09-08 10:50


     
     

OBJECT:  WScript

The WScript object is directly available to all scripts being executed by wscript or cscript and represents the currently running instance of the scripting host executable (wscript or cscript). The WScript object cannot be instantiated directly using CreateObject, however scripts running under WSH can obtain a reference to it via the Application property.

Through the WScript object one can gain access to WSH version information, the paths to the host executable and the script currently being executed, any arguments passed to the script, and the standard input, output and error streams. In addition, the WScript object can be used to instantiate, obtain references to, and bind to COM components. Methods and properties are also available to alter the script timeout values, and to cause the script to sleep for a specified period of time.

PROPERTIES

Application Property
The Application property is read only and returns a reference to the current WScript instance.

Syntax: WScript.Application

BuildVersion Property
The BuildVersion property is read only and returns a Long value which is the build version number of the host executable file (cscript or wscript).

Syntax: WScript.BuildVersion

FullName Property
The FullName property returns the full path to the host executable file (cscript or wscript). This property is read only.

Syntax: WScript.FullName

Interactive Property
The Interactive property returns a Boolean that indicates whether or not the host executable file (cscript or wscript) was invoked in interactive mode. This property is read/write and can be used to change the mode of the currently executing script at runtime. When this property is False, interactive commands such as Echo, MsgBox and InputBox have no effect. The WshShell.Popup method, and the use of StdErr, StdIn and StdOut are, however, unaffected by the setting of this property.

Syntax: WScript.Interactive[ = True|False]

Name Property
The Name property is read only and returns the name of the WScript object (usually "Windows Script Host"). This is the default property of the WScript object.

Syntax: WScript[.Name]

Path Property
The Path property is read only and returns the full path to the directory containing the host executable file (wscript or cscript).

Syntax: WScript.Path

ScriptFullName Property
The ScriptFullName property is read only and returns the full path to the script currently being executed.

Syntax: WScript.ScriptFullName

ScriptName Property
The ScriptName property is read only and returns the filename of the script currently being executed.

Syntax: WScript.ScriptName

StdErr Property
The StdErr property returns a write-only TextStream object that outputs text to the Standard Error stream. This property is read only and can only be used when cscript is the host executable.

Syntax: WScript.StdErr

StdIn Property
The StdIn property returns a read-only TextStream object that reads text from the Standard Input stream. This property is read only and can only be used when cscript is the host executable.

Syntax: WScript.StdIn

StdOut Property
The StdOut property returns a write-only TextStream object that outputs text to the Standard Output stream. This property is read only and can only be used when cscript is the host executable.

Syntax: WScript.StdOut

Timeout Property
The Timeout property is used to set or get the timeout period (in seconds) for the currently executing script. The script will automatically be terminated after the number of seconds specified by this property, which is of type Long.

Syntax: WScript.Timeout[ = lngTimeout]

Version Property
The Version property is read only and returns a string that is the version number of the host executable.

Syntax: WScript.Version


 
COLLECTION PROPERTIES

Arguments Collection Property
The Arguments collection property is read only and returns the collection of arguments supplied when invoking the current script. The argument list does not include the name of the host executable file (cscript or wscript), or the name of the script being invoked.

Syntax: WScript.Arguments


 
METHODS

ConnectObject Method
The ConnectObject method binds the events of an object to event handlers (sinks) in the currently executing script.

Syntax: WScript.ConnectObject objObject, strSubPrefix

CreateObject Method
The CreateObject method creates an instance of a COM component with a specified ProgID and, optionally, registers the current script as a handler for events generated by the newly created object.

Syntax: WScript.CreateObject (strProgID, [strSubPrefix])

DisconnectObject Method
The DisconnectObject method disconnects any event-handling connection between the currently executing script and the specified object. If a connection with the specified object was not previously established with a call to ConnectObject, CreateObject or GetObject, then this method does nothing.

Syntax: WScript.DisconnectObject objObject

Echo Method
The Echo method concatenates its arguments into a space-separated string and displays this string in a Dialog Box (if invoked under wscript), or on the standard output stream (if invoked under cscript). Under cscript, a newline character is appended to the output. This method has no effect if the WScript.Interactive property is False.

Syntax: WScript.Echo [vntArg1] [,vntArg2] [,vntArg3] ...

GetObject Method
The GetObject method loads the specified file into the associated application and returns a reference to the instance of the application object. If an application object of the appropriate type already exists, the specified file will be loaded into the existing instance, otherwise a new instance will be created. If the specified file can be handled by multiple applications, the ProgID of the desired application can be specified. If an empty string is specified for the filename, a ProgID must be specified, and this method will behave the same as a call to CreateObject. The GetObject method can also be used to register the current script as an event-handler for the returned object.

Syntax: WScript.GetObject (strPathName [,strProgID] [,strSubPrefix])

Quit Method
The Quit method causes the current script to terminate and return the specified exit code.

Syntax: WScript.Quit [lngExitCode]

Sleep Method
The Sleep method causes execution of the current script to be suspended for the specified number of milliseconds.

Syntax: WScript.Sleep lngTime
类别:网页技术 | 评论(0) | 浏览()
 
2006-08-01 09:27
转自天极:http://homepage.yesky.com/231/2509231.shtml?324
在做一些网站(特别是BBS之类)时,经常会有充许用户输入html样式代码,却禁止脚本的运行的需求, 以达到丰富网页样式,禁止恶意代码的运行。


在做一些网站(特别是BBS之类)时,经常会有充许用户输入html样式代码,却禁止脚本的运行的需求, 以达到丰富网页样式,禁止恶意代码的运行。
当然不能用 HtmlEncode 和 HtmlDecode 方法,因为这样连基本的html代码会被禁止掉。

我在网上搜索,也没有找到好的解决办法,倒是收集了一些脚本攻击的实例:

1. <script>标记中包含的代码
2. <a href=javascript:...中的代码
3. 其它基本控件的 on...事件中的代码
4. iframe 和 frameset 中载入其它页面造成的攻击


有了这些资料后,事情就简单多了,写一个简单的方法,用正则表达式把以上符合几点的代码替换掉:
 public string wipeScript(string html)
  {
       System.Text.RegularExpressions.Regex regex1 = new System.Text.RegularExpressions.Regex(@"<script[\s\S]+</script *>",System.Text.RegularExpressions.RegexOptions.IgnoreCase);   
       System.Text.RegularExpressions.Regex regex2 = new System.Text.RegularExpressions.Regex(@" href *= *[\s\S]*script *:",System.Text.RegularExpressions.RegexOptions.IgnoreCase);   
       System.Text.RegularExpressions.Regex regex3 = new System.Text.RegularExpressions.Regex(@" on[\s\S]*=",System.Text.RegularExpressions.RegexOptions.IgnoreCase);   
       System.Text.RegularExpressions.Regex regex4 = new System.Text.RegularExpressions.Regex(@"<iframe[\s\S]+</iframe *>",System.Text.RegularExpressions.RegexOptions.IgnoreCase);   
       System.Text.RegularExpressions.Regex regex5 = new System.Text.RegularExpressions.Regex(@"<frameset[\s\S]+</frameset *>",System.Text.RegularExpressions.RegexOptions.IgnoreCase);   
       html = regex1.Replace(html, ""); //过滤<script></script>标记
       html = regex2.Replace(html, ""); //过滤href=javascript: (<A>) 属性
       html = regex3.Replace(html, " _disibledevent="); //过滤其它控件的on...事件
       html = regex4.Replace(html, ""); //过滤iframe
       html = regex5.Replace(html, ""); //过滤frameset
       return html;
  }


此方法输入可能包含脚本的html代码,返回则就是干净的代码了。
我做过一些简单的测试,可以满中要求,只是还存在几个疑问:
以上考滤的情况是否比较完善, 还存在其它的脚本攻击手段吗?
是否会有其它更好的解决办法?
类别:网页技术 | 评论(1) | 浏览()
 
     
 
 
文章分类
 
 
 
 
Dotnet(41)
 
 
 
 
Flex(6)
 
 
 
     
 
文章存档
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
     
 
最新文章评论
   

[表情]
 

I have the Mac OSX version of this solution on my blog if anyone’s intereste...
 

明白了,要加 worker.WorkerReportsProgress = true;
 

我这边测试会出现: 此BackgroundWorker 声明它不报告进度。请修改 WorkerReportsP...
 

回复bbpnb:算不上,鱼太小了,如果半斤一条,那就爽了!
 
     


©2009 Baidu