JavaScript 图形学 如果 JavaScript 能实现此功能 , 将会使图片的使用量大量减少 , 加快页面完全下载速度 . 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Javascript根本不提供WEB页绘图功能,如果客户端使用的是Windows操作系统,则推荐使用DirectAnimation控件来画图,因为Windows操作系统中均已含有此控件而不需要下载。 应该有一些技巧吧 , 比如 :function Box(X1,Y1,X2,Y2,Color){ var Width = X2 - X1 ; var Height = Y2 - Y1 ; write('<DIV style = "font-size:0;border:0;background:'+Color+';left:'+X1+';top:'+Y1+';width:'+Width+';height:'+Height+'"> </DIV>') ; return ;}也可以用来画横线及竖线 , 难道就没有画斜线和曲线的技巧了吗 ?我一直相信有 . karma(无为) 大师 , 能不能解释一下 SVG & VML , 并做一下示范 ? 1. Drawing a line using Javascript and table:<html><head><style type="text/css">TD {width:1; height:1}</style></head><body><table id="tbl" cellspacing="0" cellpadding="0" border="0"><script language="javascript">for (var i=0; i < 50; i++){ document.write ("<tr>"); for (var j=0; j < 50; j++) document.write("<td></td>"); document.write ("</tr>");}</script></table><script language="javascript">for (var i=0; i < 50; i++){ tbl.rows[49-i].cells[i].style.backgroundColor="red";}</script></body></html>2. Drawing a circle with SVG (you need to save it as a file with file extensin as .svg and a SVG viewer to see it):<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20001102//EN" "http://www.w3.org/TR/2000/CR-SVG-20001102/DTD/svg-20001102.dtd"><svg width="500" height="500"> <ellipse cx="301" cy="286" rx="149" ry="151" style="stroke-width:20; stroke-opacity:1;stroke:rgb(0,0,0);fill-opacity:1; fill:rgb(255,255,0);opacity:1"/> </svg>3. Drawing a polyline with VML:<html xmlns:v="urn:schemas-microsoft-com:vml"><head><style>v\:* { behavior: url(#default#VML); }</style></head><body><v:polyline points = "18pt,54pt,90pt,-9pt,180pt,63pt,261pt,27pt" strokecolor = "red" strokeweight = "2pt"></v:polyline></body></html> 谢谢 , 似乎 JavaScript 也只能这样了 . EXTJS中选项卡的问题 根据坐标定位并显示div jquery.form.js 中文乱码问题 关于jQuery的一个问题? js中得到多选列表框内的值 javascript能操作word文档么? 这个js怎么没反应? 怎样限制多选表单的选择项数目? m_String.indexOf("'")!=0 的写法问题 有n个name="abcd"的inpu,不用循环,如何知道当前的是第几个? 关于inNaN! 怎样实现取消某一选项。。。。。?利用JSCRIPT
function Box(X1,Y1,X2,Y2,Color)
{
var Width = X2 - X1 ;
var Height = Y2 - Y1 ;
write('<DIV style = "font-size:0;border:0;background:'+Color+';left:'+X1+';top:'+Y1+';width:'+Width+';height:'+Height+'"> </DIV>') ;
return ;
}
也可以用来画横线及竖线 , 难道就没有画斜线和曲线的技巧了吗 ?
我一直相信有 .
<html>
<head>
<style type="text/css">
TD {width:1; height:1}
</style>
</head>
<body>
<table id="tbl" cellspacing="0" cellpadding="0" border="0">
<script language="javascript">
for (var i=0; i < 50; i++)
{
document.write ("<tr>");
for (var j=0; j < 50; j++)
document.write("<td></td>");
document.write ("</tr>");
}
</script>
</table>
<script language="javascript">
for (var i=0; i < 50; i++)
{
tbl.rows[49-i].cells[i].style.backgroundColor="red";
}
</script>
</body>
</html>2. Drawing a circle with SVG (you need to save it as a file with file extensin as .svg and a SVG viewer to see it):
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20001102//EN"
"http://www.w3.org/TR/2000/CR-SVG-20001102/DTD/svg-20001102.dtd">
<svg width="500" height="500">
<ellipse cx="301" cy="286" rx="149" ry="151" style="stroke-width:20;
stroke-opacity:1;stroke:rgb(0,0,0);fill-opacity:1;
fill:rgb(255,255,0);opacity:1"/>
</svg>3. Drawing a polyline with VML:
<html xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<style>
v\:* { behavior: url(#default#VML); }
</style>
</head>
<body>
<v:polyline points = "18pt,54pt,90pt,-9pt,180pt,63pt,261pt,27pt" strokecolor = "red" strokeweight =
"2pt">
</v:polyline>
</body>
</html>