jquery例子
var img = $(‘#imageid');
var theimage = new image();t
heimage.src = img.attr(“src”);
alert(“width: ” + theimage.width);
alert(“height: ” + theimage.height);
js例子
var img = new image();
img.onload = function(){
宽度=this.width
高度=this.height
}
img.src = 图片地址;
进行了301重定向,把www.111cn.net和111cn.net合并,并把之前的域名也一并合并. 有两种实现方法,第一种方法是判断nginx核心变量host(老版本是http_host):
server {
server_name www.111cn.net 111cn.net ;
if ($host != 'www.111cn.net' ) {
rewrite ^/(.*)$ http://www.111cn.net/$1 permanent;
}
...
}
第二种方法:
server {
server_name 111cn.net;
rewrite ^/(.*) http://www.111cn.net/$1 permanent;
}
测试了第一种方法ok,这两种方法中, permanent是关键,详细说明见nginx重定向规则说明。
last – 基本上都用这个flag。
break – 中止rewirte,不在继续匹配
redirect – 返回临时重定向的http状态302
permanent – 返回永久重定向的http状态301
好了,现在可以检查结果,这里可以看返回的http头信息:
http://www.seo教程consultants.com/tools/headers.asp教程
第二种方法没有测试成功...
--------------------------------------------------------------------------------
测试是否定向成功
http://qinfy.net/301-redirect-for-nginx/
输入指令~
/usr/local/nginx/sbin/nginx -t
提示:
the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
configuration file /usr/local/nginx/conf/nginx.conf test is successful
测试成功~ 重启nginx~ 输入指令~
/usr/local/nginx/sbin/nginx -s reload
重启之后测试一下~是否成功设定完成! 输入指令~
curl -i imcat.tk
会输出:
http/1.1 301 moved permanently
server: nginx/0.7.65
date: tue, 03 aug 2010 01:12:37 gmt
content-type: text/html
content-length: 185
connection: keep-alive
location: http://111cn.net/
代码如下:
var iframe = document.createelement("iframe");
iframe.id = "frame-" + index;
iframe.src = url;
iframe.width = "100%";
iframe.marginwidth = "0";
iframe.scrolling = "no";
iframe.frameborder="0";
使用ie中“查看选定区域源代码”发现创建的iframe代码是<iframe frameborder=0/>,网上搜了下资料,原来是ie不认小写,我晕死....
使用
代码如下:
setattribute("frameborder", "0", 0);
//问题解决了。
代码如下:
var iframe = document.createelement("iframe");关于中文的正则表达式, 应该是^[\\u4E00-\\u9FFF]+$, 和论坛里常被人提起的^[\\u4E00-\\u9FA5]+$很接近需要注意的是论坛里说的^[\\u4E00-\\u9FA5]+$这是专门用于匹配简体中文的正则表达式, 实际上繁体字也在里面, 我用测试器测试了下, 也通过了, 当然, ^[\\u4E00-\\u9FFF]+$也是一样的结果
iframe.id = "frame-" + index;
iframe.src = url;
iframe.width = "100%";
iframe.marginwidth = "0";
iframe.scrolling = "no";
iframe.setattribute("frameborder", "0", 0); //最后一个0表示是否区别大小写,问题解决
关于中文的正则表达式, 应该是^[u4e00-u9fff]+$, 和论坛里常被人提起的^[u4e00-u9fa5]+$很接近需要注意的是论坛里说的^[u4e00-u9fa5]+$这是专门用于匹配简体中文的正则表达式, 实际上繁体字也在里面, 我用测试器测试了下, 也通过了, 当然, ^[u4e00-u9fff]+$也是一样的结果
正则表达式匹配汉字中文var
str = "网页制作教程ww.111cn.net";
if (/^[u4e00-u9fa5]+$/.test(str)) {
alert("该字符串全部是中文");
} else {
alert("该字符串不全部是中文");
}
php教程正则中文
<?php
$str = "php编程";
if (preg_match("/^[u4e00-u9fa5]+$/",$str)) {
print("该字符串全部是中文");
} else {
print("该字符串不全部是中文");
}
?>
匹配中文字符的正则表达式: [u4e00-u9fa5]
匹配双字节字符(包括汉字在内):[^x00-xff]
匹配空行的正则表达式:n[s ¦ ]*r
匹配html标记的正则表达式:/ <(.*)> .* </1> ¦ <(.*) /> /
匹配首尾空格的正则表达式:(^s*) ¦(s*$)
第一步:设置fckconfig.网页特效,在fckeditor目录下的
//设置语言类型为php教程
var _filebrowserlanguage = 'php' ; // asp教程 | aspx | cfm | lasso | perl | php | py
var _quickuploadlanguage = 'php' ; // asp | aspx | cfm | lasso | perl | php
//开启图片上传
fckconfig.imageupload = true ;
//关闭服务器浏览功能,个人认为这个功能很鸡肋...
fckconfig.imagebrowser = false ;
第二步:设置config.php
路径:fckeditor/editor/filemanager/connectors/php/config.php
$config['enabled'] = true ;//是否启用
$config['userfilespath'] = '/html/fckeditor/upload/' ;//相对根目录的路径
$config['userfilesabsolutepath'] = 'f:\apps教程erv\www\myreach\wwwroot\html\fckeditor\upload\' ;//绝对路径
当然,上传目录必须为可写的,因为如果你设置的子目录(相对于上传目录)不存在,fckeditor会自动创建的。
例如,上传目录为upload,你要按日期归档上传的图片,图片路径设置为upload/2010/02/17/,fckeditor在上传图片时会自动 创建2010/02/17这样的子目录。
早期版本的fckeditor要求上传目录必须存在而不会自动创建。
这样强大的在线上传功能就实现了。
最后一步,找到fckeditor/editor/dialog/fck_image/fck_image_preview.html里面把里面的一段英 文删掉,不然在图片预览的时候会显示在图片旁边。