2007年6月6日星期三
JavaScript窗口之定制新窗口参数
window.open()方法的基本语法结构是:
window.open(sURL, sName);
然而,你可以通过使用2个附加的参数定制新窗口:
window.open(sURL, sName[, sFeatures][, bReplace]);
通过省略这些参数,你可以使用默认特征。让我们先看看bReplace参数,它仅仅被Internet Explorer:4和以后版本所支持。只有当第2个参数命名一个已经存在的窗口时,这个参数才有用。它是一个Boolean型数值,如果为true,就 表示第一个参数指定的URL替换当前窗口浏览位置在历史中保存的地址,如果为false,就表示在窗口的浏览历史记录中创建一个新项目(这是默认情况)。 由于这个参数只被微软的浏览器所支持,所以显得不很有用。下面让我们看看广为人知的JavaScript窗口设置性质。
open()方法的第3个参数是一个字符串,包含一个以逗号分隔的选项列表(不要包含任何空格)。在驶入可用功能的海洋前,先让我们看看它们的含义所在。这里有一个例子:
win = window.open("http://www.docjs.com/", "docjs", "location=1,menubar=1,resizable=1");
这个语句打开一个可变尺寸的窗口,它带有一个地址栏和一个菜单条,而其他的特征都被关闭。比如,没有指定status特征,新窗口就没有了状态栏。注意,还有几个其他的方法来定义窗口特征。下面是几个和前面语句功能等价的命令:
win = window.open("http://www.docjs.com/", "docjs", "location,menubar,resizable");
win = window.open("http://www.docjs.com/", "docjs", "location=yes,menubar=yes,resizable=yes");
win = window.open("http://www.docjs.com/", "docjs", "location,menubar=1,resizable=yes");
许多特征可以是yes,或者是no。对于这些特征,你也可以使用1代替yes,0代替no。如果你想激活一个特征,同样可以简单地在 sFeatures字符串中列出特征的名字。如果没有列出,就表示屏蔽该功能(titlebar和hotkeys除外)。sFeatures参数是一个以 逗号分隔的功能列表,其中不应该包含任何空格或者空白字符。列表中的每一个元素应该包含下面的格式:
feature[=value]
分配sFeatures参数一个空字符串与全部省略这个参数之间有一个很大的区别。如果调用open()没有任何参数,那么所有的特征都被设置为默认 值。换言之,浏览器将创建一个窗口,它有默认得宽度和高度、标准的菜单、工具栏,以及其他浏览器具备的特征。如果你使用空字符串做为需要功能的列表,浏览 器将打开一个窗口,它的所有特征都是被屏蔽的(titlebar和hotkeys除外)。
window.open()方法的第2个参数sName指定了窗口的名字。如果是一个已经存在窗口的名字,浏览器就在那个窗口中装载指定的URL(sURL)。所以,如果sName指定了存在的窗口,浏览器就将忽视定义的特征列表。
不是所有的窗口特征都能被所有的浏览器所支持。如果浏览器不能识别指定的特征,它就简单地忽视掉。下面来看看JavaScript中各种窗口特征的定义:
alwaysLowered
Internet Explorer:不支持
Navigator:版本 4+
指定窗口总是保留在堆栈的最下面。换言之,不管新窗口是否激活,总是其他窗口下。
window.open("alwayslowered.html", "_blank", "alwaysLowered");
alwaysRaised
Internet Explorer:不支持
Navigator:版本 4+
指定窗口总是保留在堆栈的最上面。换言之,不管新窗口是否激活,总是其他窗口上。
window.open("alwaysraised.html", "_blank", "alwaysRaised");
channelmode
Internet Explorer:版本 4+
Navigator:不支持
指定是否按照剧场模式显示窗口,以及是否显示频道区。
window.open("channelmode.html", "_blank", "channelmode");
dependent
Internet Explorer:不支持
Navigator:版本 4+
定义是否窗口成为当前打开窗口的依赖子窗口。依赖窗口就是当它的父窗口关闭时,它也随即关闭。在windows平台上,一个依赖窗口不会在任务栏上显示。
window.open("dependent.html", "_blank", "dependent");
directories
Internet Explorer:所有版本
Navigator:所有版本
指定是否显示目录按钮(比如众所周知的"What's Cool" and "What's New" 按钮)。Internet Explorer将这些目录按钮引用为链接工具栏,Navigator(版本4和以上)称之为个人工具栏。
window.open("directories.html", "_blank", "directories");
fullscreen
Internet Explorer:版本 4+
Navigator:不支持
定义是否按照全屏方式打开浏览器。请小心使用全屏模式,因为在这种模式下,浏览器的标题栏和菜单都被隐藏,所有你应该提供一个按钮或者其他可视的线索来帮助用户关闭这个窗口。当然,使用热键ALT+F4也能关闭窗口。
window.open("fullscreen.html", "_blank", "fullscreen");
height
Internet Explorer:所有版本
Navigator:所有版本
以象素pixel为单位定义窗口文档显示区域的高度,最小数值是100。如果仅仅定义高度,Internet Explorer使用给定的高度和默认的宽度。对于Navigator,如果不同时指定width或者innerWidth,那么就将忽略这个属性。
window.open("height.html", "_blank", "height=200,width=300");
hotkeys
Internet Explorer:不支持
Navigator:版本 4+
如果没有定义(或者为0),那么就屏蔽了没有菜单条的新窗口的大部分热键。但是安全以及退出热键仍然保留。
window.open("hotkeys.html", "_blank", "hotkeys=0,menubar=0");
innerHeight
Internet Explorer:不支持
Navigator:版本 4+
以象素pixel为单位定义窗口文档显示区域的高度,最小数值是100。在Navigator版本4中,这个特征替换height,为得是保持向后兼容。对于Navigator,如果不同时指定width或者innerWidth,那么就将忽略这个属性。
window.open("innerheight.html", "_blank", "innerHeight=200,innerWidth=300");
innerWidth
Internet Explorer:不支持
Navigator:版本 4+
以象素pixel为单位定义窗口文档显示区域的宽度,最小数值是100。在Navigator版本4中,这个特征替换width,为得是保持向后兼容。对于Navigator,如果不同时指定height或者innerHeight,那么就将忽略这个属性。
window.open("innerwidth.html", "_blank", "innerHeight=200,innerWidth=300");
left
Internet Explorer:版本 4+
Navigator:不支持
以象素为单位定义窗口的X左标。
window.open("left.html", "_blank", "left=20");
location
Internet Explorer:所有版本
Navigator:所有版本
定义是否显示浏览器中供地址URL输入的文本域。
window.open("location.html", "_blank", "location");
menubar
Internet Explorer:所有版本
Navigator:所有版本
定义是否显示菜单条(菜单条位于窗口顶部,包括"文件"和"编辑"等)。
window.open("menubar.html", "_blank", "menubar");
outerHeight
Internet Explorer:不支持
Navigator:版本 4+
以象素为单位定义窗口(它的外部边界)的总高度,最小数值比100多一些,因为窗口内容区域的高度必须至少是100。如果没有同时定义outerWidth,Navigator将忽视这个特征。
window.open("outerheight.html", "_blank", "outerHeight=200,outerWidth=300");
outerWidth
Internet Explorer:不支持
Navigator:版本 4+
以象素为单位定义窗口(它的外部边界)的总宽度,最小数值比100多一些,因为窗口内容区域的宽度必须至少是100。如果没有同时定义outerHeight,Navigator将忽视这个特征。
window.open("outerwidth.html", "_blank", "outerHeight=200,outerWidth=300");
resizable
Internet Explorer:所有版本
Navigator:所有版本
定义是否窗口可以通过它的边界进行大小缩放控制。依赖于平台不同,用户也许还有其他改变窗口大小的方法。
window.open("resizable.html", "_blank", "resizable");
screenX
Internet Explorer:不支持
Navigator:版本 4+
以象素为单位定义窗口的X坐标。
window.open("screenx.html", "_blank", "screenX=20");
screenY
Internet Explorer:不支持
Navigator:版本 4+
以象素为单位定义窗口的Y坐标。
window.open("screeny.html", "_blank", "screenY=20");
scrollbars
Internet Explorer:所有版本
Navigator:所有版本
定义是否激活水平和垂直滚动条。
window.open("scrollbars.html", "_blank", "scrollbars");
status
Internet Explorer:所有版本
Navigator:所有版本
定义是否在窗口的下部添加状态栏。
window.open("status.html", "_blank", "status");
titlebar
Internet Explorer:Version 5+
Navigator:版本 4+
定义是否显示窗口的标题栏。在Internet Explorer中,除非调用者是一个HTML应用程序或者一个可信任的对话框,那么这个特征是被屏蔽的。
window.open("titlebar.html", "_blank", "titlebar=0");
toolbar
Internet Explorer:所有版本
Navigator:所有版本
定义是否显示浏览器的工具栏(位于窗口的上部,包括"后退"和"向前")。
window.open("toolbar.html", "_blank", "toolbar");
top
Internet Explorer:版本 4+
Navigator:不支持
以象素为单位定义窗口的纵坐标。
window.open("top.html", "_blank", "top=20");
width
Internet Explorer:所有版本
Navigator:所有版本
以象素pixel为单位定义窗口文档显示区域的宽度,最小数值是100。如果仅仅定义宽度,Internet Explorer使用给定的宽度和默认的高度。对于Navigator,如果不同时指定height或者innerHeight,那么就将忽略这个属性。
window.open("width.html", "_blank", "height=200,width=300");
z-lock
Internet Explorer:不支持
Navigator:版本 4+
定义窗口激活时不在堆栈中浮起,就是说,新窗口当被激活时并不能位于其他窗口之上。
window.open("zlock.html", "_blank", "z-lock");
2007年5月30日星期三
Adobe Labs - Spry framework for Ajax
2007年5月17日星期四
div+css命名参考
用了一段CSS 布局设计网页,发现自己的命名有点混乱,完全按照自己的想法命名,虽然没什么影响,有不给别人看源文件,但是工作室有时候和团队合作完
成项目的时候,就遇到麻烦了,要修改一个地方相当的费事.所以还是有个标准比较好啊!
在网上看到的一个相关的参考,再加上平时也研究别人的代码,发现这样的命名使用很广泛!我再加上自己的经验,希望对看到这篇文章的人能有用!
命名参考
常用的CSS命名规则:
头:header
内容:content/container
尾:footer
导航:nav
侧栏:sidebar
栏目:column
页面外围控制整体布局宽度:wrapper
左右中:left right center
命名全部使用小写字母,如果需要多个单词,单词间使用"-"分隔,比如user-list
常用代码结构:
div:主要用于布局,分割页面的结构
ul/ol:用于无序/有序列表
span:没有特殊的意义,可以用作排版的辅助,例如
<li><span>(4.23)</span>天幻网六周年天幻网六周年天幻网六周年天幻网六</li>
然后在css中定义span为右浮动,实现了日期和标题分两侧显示的效果
h1-h6:标题
h1-h6 根据重要性依次递减
h1位最重要的标题
label:为了使你的表单更有亲和力而且还能辅助表单排版的好东西,例如:
<label for="user-password">密码</label>
<input type="password" name="password" id="user-password" />
fieldset & legend:fildset套在表单外,legend用于描述表单内容。例如:
<form>
<fieldset>
<legend>title</legend>
<label for="user-password">密码</label>
<input type="password" name="password" id="user-password" />
</fieldset>
</form>
dl,dt,dd:当页面中出现第一行为类似标题/简述,然后下面为详细描述的内容时应该使用该标签,例如
<dl>
<dt>什么是CSS?</dt>
<dd>CSS就是一种叫做样式表(stylesheet)的技术。也有的人称之为层叠样式表(Cascading
Stylesheet)。<dd>
<dt>什么是XHTML?</dt>
<dd>XHTML是一个基于XML的置标语言,看起来与HTML有些想像,只有一些小的但重要的区别。可以这样看,XHTML就是一个扮演着类似
HTML的角色的XML。 本质上说,XHTML是一个桥接(过渡)技术,结合了XML(有几分)的强大功能及HTML(大多数)的简单特性。</
dd>
</dl>
C #content
S #subcol
M #maincol
X #xcol
这是纵向布局的XHTML结构,c-smx表示网页有三个纵栏, c-sm表示有两个纵栏, c-mx表示有两个纵栏其中一个是附属的, c-m表示一
个纵栏。
其中在三纵栏的布局需要分为两层 第一层是#subcol与#main第二层是#main中的#maincol与#xcol。
自定义命名:
根据w3c网站上给出的,最好是用意义命名
比如:是重要的新闻高亮显示(像红色)
有两种
.red{color:red}
.important-news{color:red}
很显然第二种传达的意义更加明确,所以尽量不要用意义不明确的作为自己自定义的名字。
2007年4月9日星期一
Bookmark Bliss: 50 sources for web design inspiration
When Fuzzy Future first got started, I said that our goal was to build content that other people can use to improve their own projects. Almost every day, while I'm checking out a blog or social bookmark site like Del.icio.us or Digg, I see a post entitled something along the lines of "50 beautiful web designs" or "25 amazing wordpress templates." As a web developer and not really a web designer, I always love these posts because they're great inspiration for the next time I need to create my own template, theme, site, etc. Over the years I've managed to build up a decent bookmark list of these "inspirational" sites so I thought I would put them all in one place for other people to take advantage of as well. So, without further ado, here is my list of 50 sources for web design inspiration…A little help for us artistically challenged individuals
- The Best Designs
- Six Shooter Media's Free Templates
- 2Advanced Studios
- Andreas Viklund Free Website Templates
- Studio7Designs
- Style Grind
- Open Source Web Design
- The Web Design Inspiration Photoset
- Most Inspired
- Open Source Templates
- Templates Box
- Smashing Magazine
- CSS Beauty
- CSS Galleries
- Drupal Sites
- Open Source Web Templates
- CSS Remix
- Glenn Wolsey 10 Most Beautiful Blog Designs
- CSS Drive
- Perfection
- CSS Elite
- SyleGala
- Creative Pakistan
- The FWA
- CSS Hazard
- Beautifully Webdesign
- Unmatched Style
- CSS Import
- Light on Dark
- StyleBoost
- CSS Bloom
- Screen Fluent
- CSS Websites
- Website Design Awards
- 3point7designs
- CSS Galaxy
- Screenalicio.us
- The Dreamer
- Style Crunch
- CSS Flavor
- Inspiration King
- CSS Thesis
- Web Creme
- CSS Zen Garden
- CSS Reboot
- WebDigity
- The Pixel Creativity
- Top Wordpess Themes
- CSSClip
- Deviant Art
50+5 Bonus Sources
- 83 Beautiful Wordpress Themes (smashing magazine)
- Go Drupal
- One Pixel Army
- CSS Mania
- Design Shack
Well, that's it for this round. Some of these sites offer their templates for free but others charge a fee for you to use. This list is intended to help you with your "designer's block" and give you the inspiration you need to come up with the perfect design for your next blog, community portal, social networking hub, or corporate e-commerce resource. I'd love to keep this list growing and possibly release updates on a regular basis.
Have you found this list useful? If so, show your support by subscribing to our news feed. We've posted several other entries in our Bookmark Bliss series that you might find interesting as well…
- Bookmark Bliss: 50 Sources for Web Design Inspiration
- Bookmark Bliss: The Developer Cheat Sheet Compilation
- Bookmark Bliss: 30 Web Developer Community Forums
- Bookmark Bliss: 101+ Stock Image Resources
As always, your comments are welcome and please let us know of any sites we might have missed.
2007年4月5日星期四
2007年2月15日星期四
Free Design Templates
*Just in case the site goes down*
Here's all the links. Save them. You might need them some day when you're looking for templates
http://www.freecsstemplates.org/
http://www.webpagedesign.com.au/Free_Templates/
http://www.templatesbox.com/templates.htm
http://www.templatemonster.com/free-templates.php
http://templatenavigator.com/
http://www.coffeecup.com/freestuff/templates/
http://www.dotcomwebdesign.com/?Free-Website-Templates-Section-1
http://effex-media.com/templates/
http://www.entheosweb.com/website_templates/free-dreamweaver-templates.asp
http://www.dezinehub.com/
http://www.free-flash-template.com/
http://www.freelayouts.com/templates/website
http://www.webdesignerstoolkit.com/index.php
http://www.freetemplatesonline.com/
http://www.freewebtemplates.com/template.php?id=3
http://www.freewebtemplates.de/
http://www.freewebsitetemplates.com/
http://www.ginger-ninja.net/
http://www.groovylizard.com/site/linkware.htm
http://hotfreetemplates.com/WebsiteTemplates/
http://www.interspire.com/templates/
http://www.ajoyfulheart.com/floral_linkware_sets.htm
http://layouts4free.com/
http://www.mastertemplates.com/
http://www.oswd.org/
http://www.openwebdesign.org/
http://www.paintedpixels.com/graphics/index.php
http://www.rickyswebtemplates.com/
http://www.snakeyewebtemplates.com/free_dreamweaver_web_site_templates.asp
http://www.steves-templates.com/templates.html
http://www.templateperfection.com/?parent=1&sm=1
http://www.templateworkz.com/website_templates.php
http://www.themesbase.com/
http://capmex.biz/resources/free-web-templates
http://www.webtemplates.la/
http://zymic.com/show_templates.php?id=1
Weblog Templates
http://www.blogfashions.com/
http://www.glish.com/css/blogger/
http://blogger-templates.blogspot.com/
http://blogspottemplates.blogspot.com/
http://freetemplates.blogspot.com/
http://www.bloggingthemes.com/
http://blogplates.net/
http://erraticwisdom.com/templates
http://finalsense.com/services/blogs_templates.html
http://www.francey.org/linkware
http://blog-templates.ravasthi.name/
http://www.kaushalsheth.com/themes
http://pinkfreak.niftykeen.net/design/archives/templates/index.html
http://www.pointoffocus.com/Graphics/focusblogger.html
http://scribez.wordpress.com/2006/09/16/new-ten-best-free-wordpress-templates/
http://textgarden.org/
http://textplates.com/
http://v4ny.net/themes-and-templates/
http://www.weblogdesign.com/website.php
http://wpthemes.info/
Wow if this comment wasn't on topic, I'd digg this down for linkspam.
Enjoy!