如何获得像这样背景不透明的弹出窗口?
我想在我的网站上弹出模式窗口(它是一个背景不透明的窗口)来显示一些数据。请检查下面的图片:
我想使用类似的实现: http://www.smartclient.com/?skin =企业#模态 但我不知道该怎么做。谁能帮我实现这个?我找不到从这里下载哪个文件: http://www.smartclient.com/产品/download.jsp
那不是像 MooTools 或 jQuery 框架之类的东西吗?我无法理解要从他们下载的库中包含哪个文件。 有人可以给我提供一个示例 html 页面代码来做到这一点吗?
另一件事是,我在他们的源代码中看到以下代码:
isc.IButton.create({
ID: "touchButton",
width: 120,
title: "Touch This"
});
isc.Label.create({
left: 150,
height: 20,
contents: "<a href='http://www.google.com' target='_blank'>Open Google</a>"
});
isc.IButton.create({
title: "Show Window",
top: 35,
left: 75,
click : function () {
touchButton.setTitle("Can't Touch This");
modalWindow.show();
}
});
isc.Window.create({
ID: "modalWindow",
title: "Modal Window",
autoSize:true,
autoCenter: true,
isModal: true,
showModalMask: true,
autoDraw: false,
closeClick : function () { touchButton.setTitle('Touch This'); this.Super("closeClick", arguments)},
items: [
isc.DynamicForm.create({
autoDraw: false,
height: 48,
padding:4,
fields: [
{name: "field1", type: "select", valueMap: ["foo", "bar"]},
{name: "field2", type: "date"},
{type: "button", title: "Done",
click: "modalWindow.hide();touchButton.setTitle('Touch This')" }
]
})
]
});
我担心以下代码:
fields: [
{name: "field1", type: "select", valueMap: ["foo", "bar"]},
{name: "field2", type: "date"},
{type: "button", title: "Done",
click: "modalWindow.hide();touchButton.setTitle('Touch This')" }
]
有人可以告诉我它是什么类型的代码吗? MooTools 或 jQuery 中有类似的东西吗? 我对这些事情一窍不通。请帮忙。先感谢您。
I want to have modal window pop up (it is a window with opacity in background) on my website to display some data. Please check image below :
I would like to use similar implementation as: http://www.smartclient.com/?skin=Enterprise#modality
But i couldn't figure out how to do that. Can anyone help me implement this? I couldn't find which file to download from here: http://www.smartclient.com/product/download.jsp
Isn't that something like MooTools or jQuery framework? I can't understand which file to include from their downloaded library.
Can some one please provide me an example html page code to do that?
Another thing is, i saw following code in their source :
isc.IButton.create({
ID: "touchButton",
width: 120,
title: "Touch This"
});
isc.Label.create({
left: 150,
height: 20,
contents: "<a href='http://www.google.com' target='_blank'>Open Google</a>"
});
isc.IButton.create({
title: "Show Window",
top: 35,
left: 75,
click : function () {
touchButton.setTitle("Can't Touch This");
modalWindow.show();
}
});
isc.Window.create({
ID: "modalWindow",
title: "Modal Window",
autoSize:true,
autoCenter: true,
isModal: true,
showModalMask: true,
autoDraw: false,
closeClick : function () { touchButton.setTitle('Touch This'); this.Super("closeClick", arguments)},
items: [
isc.DynamicForm.create({
autoDraw: false,
height: 48,
padding:4,
fields: [
{name: "field1", type: "select", valueMap: ["foo", "bar"]},
{name: "field2", type: "date"},
{type: "button", title: "Done",
click: "modalWindow.hide();touchButton.setTitle('Touch This')" }
]
})
]
});
I am concerned about following code :
fields: [
{name: "field1", type: "select", valueMap: ["foo", "bar"]},
{name: "field2", type: "date"},
{type: "button", title: "Done",
click: "modalWindow.hide();touchButton.setTitle('Touch This')" }
]
Can some one please tell me what kind of code it is? Is there something like that available in MooTools or jQuery?
I am n00b to these things. Please help. Thank you in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
smartclient是它自己的RIA框架,您发布的代码是他们自己的语法。
您在下面看到的代码:
是一个简单的文字数组定义,其中数组成员是字面定义的对象。这不是特定于 mootools 或 jquery 或任何框架,它只是 javascript。另外,请阅读 JSON(javascript 对象表示法),本质上是上述内容的传输形式。
至于类似 mootools UI 的版本:
smartclient is its own RIA framework, the code you posted is their own syntax.
the code you see below:
is a simple literal array definition where the array members are literally defined objects. This is not specific to mootools or jquery or any framework, it's just javascript. also, read up on JSON (javascript object notation), essentially a transport form of the above.
as for mootools UI-like releases:
如果您想创建模式对话框,您可以轻松使用 Jquery UI 对话框并添加您的表单
进行对话。
Jquery UI 对话框
If you want to create modal dialog, you can easily use Jquery UI Dialog and add your form
to dialog.
Jquery UI Dialog
要使用 mootools 创建对话框,您可以使用 MooDialog
To create dialogs with mootools you can use MooDialog
首先,您需要熟悉 JavaScript 才能理解上面的 SmartClient 代码,我相信您已经熟悉了。
现在关于代码:
SmartClient 已构建其所有组件来支持 json/xml 数据格式。我们在这里不讨论 xml(可扩展标记语言)。
现在介绍 json(javascript 对象表示法); Json 是非常简单且标准的格式,如果您了解 javascript,就可以学习。向/从客户端/服务器传递任何信息/参数;就像我们在 html ex 中所做的那样。 www.google.com?param=value; json 用冒号“:”字符分隔每个参数(键)和值。现在,如果您看到上面的代码,那么任何“{”和“}”之间的所有属性(参数)和值都代表一个 json。如果大括号“{}”嵌套,则存在嵌套的 json,如果 json 位于长括号“[]”之间,则表示 json 数组。
前任。如果有任何实体(例如用户)的表,那么它的 json 将为
[{user 1 json...}、{user 1 json...} 等等...]
但如果有任何一个 html 表单(在 SmartClient 中是 DynamicForm),那么一个json 就足够了 {用所有字段形成 json...}
让我们再次回顾一下代码:
第一行是
isc.IButton.create - SmartClient属于同构(isc),因此任何isc组件都是使用isc.COMPONENT.create({})创建的;在“({...})”之间,您需要编写 json,其中 width: 120 只是一个 json。
代码中的任何类似 click、closeClick 的事件都只不过是像 html 中的 mouseover 一样的 javascript 匿名函数。
在 isc.Window.create 代码中,存在 json 和 json 元素数组的嵌套,并且 Window 是具有给定属性的 SmartClient 特定组件。
最后一个例子:
如果实体 User: 的属性 rollNo 为 1 且 name: "no-name" 那么它的 json 将为:
{“用户”:{“rollNo”:“1”,“名称”:“无名称”}}
或者
{"rollNo": "1", "name": "no-name"}
如果有两个这样的用户
[
{"rollNo": "1", "name": "no-name-1"},
{"rollNo": "2", "name": "no-name-2"}
]
你关于不透明度的问题的答案是;在窗口组件中使用以下属性:
modalMaskOpacity:50
此属性控制模态窗口后面显示的模态掩码的不透明度,值从 0(透明)到 100(不透明)变化,
谢谢
沙鲁
First you need to be comfortable with javascript to understand above SmartClient code, which I believe you already are.
Now about code:
SmartClient has build all of its component to support json/xml data formats. We are not discussing xml (eXtensible Markup Language) over here.
Now about json (javascript object notation); Json is very simple and standard format to learn if you know javascript. To pass any information/parameters to/from client/server; like we do in html ex. www.google.com?param=value; json separates every param(key) and value by colon ":" character. Now if you see above code then all attributes (params) and values between any "{" and "}" represent one json. If curly braces "{}" are nested then there are nested jsons and if jsons are between long braces "[]", then it represent array of json.
Ex. If there is table of any entity say users, then its json would be
[{user 1 json...}, {user 1 json...} and so on...]
but if there is any one html form (in SmartClient it is DynamicForm) then a single json is enough {form json with all fields...}
Let's revisit code once again:
the very first line is
isc.IButton.create - SmartClient belongs to isomorphic (isc), so any isc component is created using isc.COMPONENT.create ({}); between "({...})" you need to write json where width: 120 is nothing but a json.
Any event like click, closeClick in the code are nothing but a javascript anonymous function like mouseover in html.
In isc.Window.create code there is nesting of json and array of json elements and Window is SmartClient specific component with given attributes.
Last example:
if there is entity User: has attributes rollNo as 1 and name: "no-name" then its json would be:
{"user": {"rollNo": "1", "name": "no-name"}}
or
{"rollNo": "1", "name": "no-name"}
and if there are two such users then
[
{"rollNo": "1", "name": "no-name-1"},
{"rollNo": "2", "name": "no-name-2"}
]
And answer to your question about opacity is; use below property in window component:
modalMaskOpacity: 50
This property controls the opacity of the modal mask displayed behind modal windows and the value varies from 0 (transparent) to 100 (opaque)
Thanks
shaILU