data url 用于直接内嵌资源文件,
HTMLayout 以及 IE8+,Firefox,Chrome,Opera,Safari 等浏览器都支持该语法。
下面是使用范例:
import win.ui;
/*DSG{{*/
var winform = ..win.form( bottom=399;parent=...;right=599;text="aardio Form" )
winform.add( )
/*}}*/
import web.layout;
var wbLayout = web.layout(winform);
wbLayout.html = /*********
<html>
<head>
<style>
div.test {
background-image: url(data:image/gif;base64,
R0lGODdhMAAwAPAAAAAAAP///ywAAAAAMAAw
AAAC8IyPqcvt3wCcDkiLc7C0qwyGHhSWpjQu5yqmCYsapyuvUUlvONmOZtfzgFz
ByTB10QgxOR0TqBQejhRNzOfkVJ+5YiUqrXF5Y5lKh/DeuNcP5yLWGsEbtLiOSp
a/TPg7JpJHxyendzWTBfX0cxOnKPjgBzi4diinWGdkF8kjdfnycQZXZeYGejmJl
ZeGl9i2icVqaNVailT6F5iJ90m6mvuTS4OK05M0vDk0Q4XUtwvKOzrcd3iq9uis
F81M1OIcR7lEewwcLp7tuNNkM3uNna3F2JQFo97Vriy/Xl4/f1cf5VWzXyym7PH
hhx4dbgYKAAA7);
background-repeat:repeat;
width:200px;
height:200px;
border:1px solid black;
}
</style>
</head>
<body>
<h1> Data URL 演示</h1>
<div .test />
</body>
</html>
*********/
winform.show()
win.loopMessage();
data url也可以直接用于html中,例如img图像节点的src属性。
|