易截截图软件、单文件、免安装、纯绿色、仅160KB
热门标签: c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 最新文章 : javascript

IE FireFox safari下javascript操作embed标签(转)

这段时间太忙了,都没时间我工作心得写下来了,今天抽个时间把前两天工作中碰到的一些很棘手的问题以及解决的方法:
问题描述:
embed标签接受到直播流以后在IE下可以通过play()和pause()方法得到很好的播放/暂停的控制,但在FireFox和safari 去无能为力,在Firefox和safari下可以正常的播放(在safari需要装media插件),但是就是通过play() 和pause()无法控制它的播放和暂停,问题的根源是Firefox和Safari不能很好的支持embed标签。就这个一个小问题耗了好多时间,恼火啊!
解决方法:
也许会有更好的方法,我的解决方法是这样的:当点击暂停按钮的时候,首先去判断浏览器的类型,如果不是IE就直接把Embed这个标签从DOM中remove掉,单点播放按钮的时候再把Embed标签动态加载到DOM中。就这样,问题解决了。
相关代码如下:
//包含Embed标签的层
<div id="radio_container"><embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/windows/mediaPlayer/" id="player" src="http://pub.qmoon.net:8009/911pop" name="player" width="0" height="0" volume="100"> </embed></div>    
//暂定
var trnod ......

JavaScript CSS Style属性参考

CSS语法 (不区分大小写)   JavaScript语法 (区分大小写)
border   border
border-bottom   borderBottom
border-bottom-color   borderBottomColor
border-bottom-style   borderBottomStyle
border-bottom-width   borderBottomWidth
border-color   borderColor
border-left   borderLeft
border-left-color   borderLeftColor
border-left-style   borderLeftStyle
border-left-width   borderLeftWidth
border-right   borderRight
border-right-color   borderRightColor
border-right-style   borderRightStyle
border-right-width   borderRightWidth
border-style   borderStyle
border-top   borderTop
border-top-color   borderTopColor
border-top-style   borderTopStyle
border-top-width   borderTopWidth
border-width   borderWidth
clear   clear
float   floatStyle
margin   margin
margin-bottom   marginBottom
margin-left   marginLeft
margin-right   marginRight
margin-top   marginTop
padding   padding
padding-bottom ......

JavaScript CSS Style属性参考

CSS语法 (不区分大小写)   JavaScript语法 (区分大小写)
border   border
border-bottom   borderBottom
border-bottom-color   borderBottomColor
border-bottom-style   borderBottomStyle
border-bottom-width   borderBottomWidth
border-color   borderColor
border-left   borderLeft
border-left-color   borderLeftColor
border-left-style   borderLeftStyle
border-left-width   borderLeftWidth
border-right   borderRight
border-right-color   borderRightColor
border-right-style   borderRightStyle
border-right-width   borderRightWidth
border-style   borderStyle
border-top   borderTop
border-top-color   borderTopColor
border-top-style   borderTopStyle
border-top-width   borderTopWidth
border-width   borderWidth
clear   clear
float   floatStyle
margin   margin
margin-bottom   marginBottom
margin-left   marginLeft
margin-right   marginRight
margin-top   marginTop
padding   padding
padding-bottom ......

javascript中replace的正则表达式语法

replace
方法
以下是javascript
中的例子
下面的示例演示了 replace
方法将第一次出现的单词 "The"
替换为单词 "A"
的用法。
function ReplaceDemo(){
   var r, re;                    //
声明变量。
   var ss = "The man hit the ball
with the bat.\n";
   ss += "while the fielder caught
the ball with the glove.";
   re = /The/g;             //
创建正则表达式模式。
   r = ss.replace(re,
"A");    //
用 "A"
替换 "The"

   return(r);                   //
返回替换后的字符串。
}
另外, replace
方法也可以替换模式中的子表达式。 下面的范例演示了交换字符串中的每一对单词:
function Replac ......

关于javascript判断文件大小

<script type="text/javascript">  
function getFileSize(filePath) {  
   var image=new Image();  
   image.dynsrc=filePath;  
   alert(image.fileSize);  
}  
</script>  
<body>  
<INPUT TYPE="file" NAME="file" SIZE="30" onchange="getFileSize(this.value)">  
</body> ......

Javascript和Ajax中文乱码吐血版解决方案

引自:http://www.cnblogs.com/dongritengfei/archive/2009/12/21/1628489.html
 
今天弄了一天的Ajax中文乱码问题,Ajax的乱码问题分为两种:
1. JavaScript输出的中文乱码,
比如:alert("中文乱码测试");
解决的办法比较简单,就是把jsp里所有的charset和pageEncoding的值都设置成相同的,一般是utf-8.
 
2. 这第二种就是Ajax从服务器端获得的数据出现乱码的问题。(我搜了n个小时试了n中方法才找到答案)
现在将我搜集的比较有效的方法都与大家分享:(我使用的开发环境是Eclipse,相信其他语言和开发环境都差不太多。)
 比如
var message = xmlHttp.responseText;
 alert("message: "+message);
获得这个message输出就是乱码
 
解决办法:
1. 修改编码。切记要将代码备份一下,改了编码之后中文会变为乱码。
在js文件上右键点击Properties,修改Text file encode 为UTF-8(这里应当与jsp中的编码相同) 
 
同样的将JavaScript source file和JSP的Default encoding设置为UTF-8(这里应当与jsp中的编码相同,这样以后的项目就都是utf-8的编码了,推荐使用这个)
2. 注意response.setContentType("text/html;charse ......

Javascript和Ajax中文乱码吐血版解决方案

引自:http://www.cnblogs.com/dongritengfei/archive/2009/12/21/1628489.html
 
今天弄了一天的Ajax中文乱码问题,Ajax的乱码问题分为两种:
1. JavaScript输出的中文乱码,
比如:alert("中文乱码测试");
解决的办法比较简单,就是把jsp里所有的charset和pageEncoding的值都设置成相同的,一般是utf-8.
 
2. 这第二种就是Ajax从服务器端获得的数据出现乱码的问题。(我搜了n个小时试了n中方法才找到答案)
现在将我搜集的比较有效的方法都与大家分享:(我使用的开发环境是Eclipse,相信其他语言和开发环境都差不太多。)
 比如
var message = xmlHttp.responseText;
 alert("message: "+message);
获得这个message输出就是乱码
 
解决办法:
1. 修改编码。切记要将代码备份一下,改了编码之后中文会变为乱码。
在js文件上右键点击Properties,修改Text file encode 为UTF-8(这里应当与jsp中的编码相同) 
 
同样的将JavaScript source file和JSP的Default encoding设置为UTF-8(这里应当与jsp中的编码相同,这样以后的项目就都是utf-8的编码了,推荐使用这个)
2. 注意response.setContentType("text/html;charse ......

Flex与Javascript互相通信

Flex与Javascript互相通信。
在Flex中有这么一个类:ExternalInterface.在这个类中它给我们:call和addCallback
Flex中As调用Js的方法是:
     1、导入包 (import flash.external.ExternalInterface;)
     2、使用ExternalInterface.call("Js函数名称",参数)进行调用,其返回的值就是Js函数所返回的值
 
Js调用As的方法是:
     1、导入包 (import flash.external.ExternalInterface;)
     2、在initApp中使用ExternalInterface.addCallback("用于Js调用的函数名",As中的函数名)进行注册下
     3、js中 就可以用document.getElementById("Flas在Html中的ID").注册时设置的函数名(参数)进行调用. ......

Flex与Javascript互相通信

Flex与Javascript互相通信。
在Flex中有这么一个类:ExternalInterface.在这个类中它给我们:call和addCallback
Flex中As调用Js的方法是:
     1、导入包 (import flash.external.ExternalInterface;)
     2、使用ExternalInterface.call("Js函数名称",参数)进行调用,其返回的值就是Js函数所返回的值
 
Js调用As的方法是:
     1、导入包 (import flash.external.ExternalInterface;)
     2、在initApp中使用ExternalInterface.addCallback("用于Js调用的函数名",As中的函数名)进行注册下
     3、js中 就可以用document.getElementById("Flas在Html中的ID").注册时设置的函数名(参数)进行调用. ......
总记录数:2244; 总页数:374; 每页6 条; 首页 上一页 [248] [249] [250] [251] 252 [253] [254] [255] [256] [257]  下一页 尾页
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号