<HTML xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<HEAD>
<style type="text/css">
v\:* {
BEHAVIOR: url(#default#VML)
}
o\:* {
BEHAVIOR: url(#default#VML)
}
.shape {
BEHAVIOR: url(#default#VML)
}
</style>
</HEAD>
<BODY>
<v:line StrokeColor='red' StrokeWeight='2' from='10,20' to='200,300' style='POSITION:absolute;'></v:line>
</BODY>
</HTML>
<HEAD>
<style type="text/css">
v\:* {
BEHAVIOR: url(#default#VML)
}
o\:* {
BEHAVIOR: url(#default#VML)
}
.shape {
BEHAVIOR: url(#default#VML)
}
</style>
</HEAD>
<BODY>
<v:line StrokeColor='red' StrokeWeight='2' from='10,20' to='200,300' style='POSITION:absolute;'></v:line>
</BODY>
</HTML>
document.write("<v:line StrokeColor='red' StrokeWeight='2' from='10,20' to='200,300' style='POSITION:absolute;'></v:line>")
v:line<html xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<STYLE>
v\:* { Behavior: url(#default#VML) }
</STYLE>
<script language="JavaScript">
<!--
var x=0;
var y=0;
var isMouseDown=false;
var newRect=null;document.onmousedown=function(){
x=window.event.clientX;
y=window.event.clientY;
isMouseDown=true;
if(newRect==null)
newRect=document.createElement('<v:rect filled="false" colors="30% yellow,70% green" style="position:absolute; top:'+ y +';left:'+ x +';width:1px;height:1px"></v:rect>');
else{
newRect.style.top=y;
newRect.style.left=x;
newRect.style.width="1px";
newRect.style.height="1px";
}
newRect.style.border="2px solid blue";//这里设置border的样式
}
document.onmousemove=function(){
if(isMouseDown==false) return;
document.body.insertBefore(newRect);
var mx=window.event.clientX;
var my=window.event.clientY;
if(mx>x){
newRect.style.width=mx-x;
}
else{
newRect.style.width=x-mx;
newRect.style.left=mx;
}
if(my>y){
newRect.style.height=my-y;
}
else{
newRect.style.height=y-my;
newRect.style.top=my;
}}
document.onmouseup=function(){
x=0;
y=0;
isMouseDown=false;
}//-->
</script>
</head>
<body onselectstart="return false;"></body>
</html>