-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VML元素的相关资料 #455
Comments
<html >
<head>
<title>by 司徒正美</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<script>
document.namespaces.add("v", "urn:schemas-microsoft-com:vml", "#default#VML");
</script>
<script src="avalon.js"></script>
<style>
.vml{
behavior: url(#default#VML);
display:inline-block;
_zoom:1;
width:200px;
height:100px;
}
</style>
<script>
var vmodel = avalon.define('test', function(vm) {
vm.array = [1, 2, 3, 4]
vm.pp = ""
vm.ss = ""
})
window.onload = function() {
var el = document.getElementById("pid")
vmodel.pp = el.outerHTML
var el2 = document.getElementById("sid")
vmodel.ss = el2.outerHTML
}
</script>
</head>
<body ms-controller="test">
<p>{{pp}}</p>
<p>{{ss}}</p>
<p><input id="input"></p>
<v:rect style='width:120px;height:80px' fillcolor="red" class="vml" id="pid">
<v:fill type="gradient" id="sid" />
</v:rect>
<v:oval strokecolor='red' fillcolor=' green ' style="width:400;height:400"/>
<v:curve style="z-index:1;left:100;position:absolute;top:300" from="0px,0px" to="150px,0px" filled='f' control1="75,150" control2="75,-150"/>
</body>
</html> 结果以下: <?import namespace = v urn = "urn:schemas-microsoft-com:vml" implementation = "#default#VML" declareNamespace /><v:rect id=pid class=vml style="HEIGHT: 80px; WIDTH: 120px" coordsize = "21600,21600" fillcolor = "red"><v:fill id=sid type = "gradient"></v:fill></v:rect> <?import namespace = v urn = "urn:schemas-microsoft-com:vml" implementation = "#default#VML" declareNamespace /><v:fill id=sid type = "gradient"></v:fill> 它也有可以是 <?xml:namespace prefix = "v" /> |
if (elem.tagUrn === "urn:schemas-microsoft-com:vml" && elem.currentStyle.behavior !== "url(#default#VML)") {
var nodes = getAll(elem)
nodes.unshift(elem)
for (var j = 0, el; el = nodes[j++]; ) {
fixVML(el)
}
} |
function supportsVml() {
if (typeof supportsVml.supported == "undefined") {
var a = document.body.appendChild(document.createElement('div'));
a.innerHTML = '<v:shape id="vml_flag1" adj="1" />';
var b = a.firstChild;
b.style.behavior = "url(#default#VML)";
supportsVml.supported = b ? typeof b.adj == "object": true;
a.parentNode.removeChild(a);
}
return supportsVml.supported
} function supportsSvg() {
return document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Shape", "1.0")
} http://cibo.org/css/pie.htc |
<html >
<head>
<title>by 司徒正美</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- <meta http-equiv="X-UA-Compatible" content="IE=7" />-->
<script>
document.namespaces.add("v", "urn:schemas-microsoft-com:vml", "#default#VML");
</script>
<script src="avalon.js"></script>
<style>
</style>
<script>
var vmodel = avalon.define('test', function(vm) {
vm.array = [1, 2, 3, 4]
})
</script>
</head>
<body ms-controller="test">
<p>现在avalon只需要添加一行<em> document.namespaces.add("v", "urn:schemas-microsoft-com:vml", "#default#VML")</em></p>
<p>定义好VML所使用的命名空间,然后保证VML元素的localName正确就行了</p>
<v:rect style='width:200px;height:80px' fillcolor="red" ms-repeat="array">
<v:fill type="gradient" id="sid" />
</v:rect>
<v:oval id=test style="width: 100px; height: 100px" >
<v:stroke weight="1px" color="navy"/>
</v:oval>
<v:line strokecolor="red" strokeweight="2"
style="z-index:5;position:absolute;left:233px;top:150px"
from="0,0" to="200,200"/>
<v:curve style="z-index:1;left:100;position:absolute;top:300"
from="0px,0px" to="150px,0px" filled='f' control1="75,150" control2="75,-150"/>
<v:oval strokecolor="black" fillcolor="white"
style="position:relative;left:9px;top:20px;width:60px;height:60px;z-index:8">
<v:shadow on="t" type="single" color="silver" offset="3pt,3pt"></v:shadow>
</v:oval>
<v:roundrect strokecolor="yellow" fillcolor="white" style="position:relative;left:20;top:5;width:100px;height:40px;z-index:9">
<v:shadow on="t" type="single" color="silver" offset="3pt,3pt"></v:shadow>
<v:textbox id="memo" style="font-size:10pt;color:green;line-height:18px" inset="1,1,1,1">Hello world!<br>Hello VML!</v:textbox>
</v:roundrect>
</body>
</html> |
一级标签 http://www.cnblogs.com/xjk15082/archive/2011/09/12/2174130.html |
E8标准模式下VML不能显示问题当页面使用下,在IE7或者IE兼容模式下,使用VML可以正常显示,但是IE8标准模式下,不能正常渲染VML,导致显示不成功 可以使用如下方法: 1、设置为IE7模式 <?import namespace="v" implementation="#default#VML" ?> 或者 document.namespaces.add("v","urn:schemas-microsoft-
com:vml","#default#VML"); 或者 if(!document.documentMode || document.documentMode<8) {
document.createStyleSheet().addRule('v\\:*', "behavior: url
(#default#VML);");
} if(document.documentMode && document.documentMode>=8) {
document.writeln('<?import namespace="v"
implementation="#default#VML" ?>'); |
判定是否为VML元素 var nodeName = el.nameName
var isVML = nodeName.toLowerCase() === nodeName && node.scopeName && node.outerText === "" |
The text was updated successfully, but these errors were encountered: