차트를 만드는 소스
작성일 07-01-10 11:11
페이지 정보
작성자서방님 조회 147회 댓글 0건본문
<html>
<head>
<script>
var strVml
function resetVml(){
strVml="<html xmlns:v='urn:schemas-microsoft-com:vml'>n<head>n"
strVml+="<title> :: 결과 출력 창 :: </title>n"
strVml+="<style>n"
strVml+="v\:* {behavior:url(#default#VML);}n"
strVml+="</style>n</head>n<body topmargin=0 leftmargin=0>n"
strVml+="<v:line style='position:absolute' from='150px,0px' to='150px,550px' strokecolor='silver' strokeweight='1px'></v:line>n"
strVml+="<v:line style='position:absolute' from='0px,300px' to='300px,300px' strokecolor='silver' strokeweight='1px'></v:line>n"
}
function drawLines(){
var preTop=-100
var preLeft=-100
var obj=document.mathForm
if(obj.ee.value!=""){var e=parseInt(obj.ee.value)}
else{e=0}
if(obj.aa.value!=""){var a=parseInt(obj.aa.value)}
else{a=0}
if(obj.bb.value!=""){var b=parseInt(obj.bb.value)}
else{b=0}
if(obj.cc.value!=""){var c=parseInt(obj.cc.value)}
else{c=0}
if(obj.dd.value!=""){var d=parseInt(obj.dd.value)}
else{d=0}
for(x=-200;x<=200;x++){
var top,left
y=a*x*x*x/e
y+=b*x*x/e
y+=c*x/e
y+=d/e
top=300-y
left=150+x
strVml+="<v:line style='position: absolute;' from='"+preLeft+"px,"+preTop+"px' to='"+left+"px,"+top+"px' "
strVml+="strokecolor='red' strokeweight='1px'>"
strVml+="<v:stroke dashstyle='solid'/></v:line>n"
preTop=top
preLeft=left
}
strVml+="</body>n</html>n"
if(!newWin){var newWin=window.open('','newWin','width=300,height=550')}
newWin.document.open()
newWin.document.write(strVml)
newWin.document.close()
newWin.focus()
}
</script>
<style>
td{font-size:11pt}
input{border:solid 1px silver;font-size:9pt;}
</style>
</head>
<body>
<form name=mathForm>
<table cellspacing=0 cellpadding=0>
<tr><td valign=top>
<input type=text name=ee size=2 value=1>y =
<input type=text name=aa size=2 value=1>x</td><td valign=top style="font-size:8pt">3</td>
<td valign=top>
+ <input type=text name=bb size=2 value=1>x</td><td valign=top style="font-size:8pt">2</td>
<td valign=top> +
<input type=text name=cc size=2 value=1>x +
<input type=text name=dd size=4 value=1>
<input type=button value="submit" onclick=resetVml();drawLines()>
</td></tr></table>
</form>
</body>
</html>
<head>
<script>
var strVml
function resetVml(){
strVml="<html xmlns:v='urn:schemas-microsoft-com:vml'>n<head>n"
strVml+="<title> :: 결과 출력 창 :: </title>n"
strVml+="<style>n"
strVml+="v\:* {behavior:url(#default#VML);}n"
strVml+="</style>n</head>n<body topmargin=0 leftmargin=0>n"
strVml+="<v:line style='position:absolute' from='150px,0px' to='150px,550px' strokecolor='silver' strokeweight='1px'></v:line>n"
strVml+="<v:line style='position:absolute' from='0px,300px' to='300px,300px' strokecolor='silver' strokeweight='1px'></v:line>n"
}
function drawLines(){
var preTop=-100
var preLeft=-100
var obj=document.mathForm
if(obj.ee.value!=""){var e=parseInt(obj.ee.value)}
else{e=0}
if(obj.aa.value!=""){var a=parseInt(obj.aa.value)}
else{a=0}
if(obj.bb.value!=""){var b=parseInt(obj.bb.value)}
else{b=0}
if(obj.cc.value!=""){var c=parseInt(obj.cc.value)}
else{c=0}
if(obj.dd.value!=""){var d=parseInt(obj.dd.value)}
else{d=0}
for(x=-200;x<=200;x++){
var top,left
y=a*x*x*x/e
y+=b*x*x/e
y+=c*x/e
y+=d/e
top=300-y
left=150+x
strVml+="<v:line style='position: absolute;' from='"+preLeft+"px,"+preTop+"px' to='"+left+"px,"+top+"px' "
strVml+="strokecolor='red' strokeweight='1px'>"
strVml+="<v:stroke dashstyle='solid'/></v:line>n"
preTop=top
preLeft=left
}
strVml+="</body>n</html>n"
if(!newWin){var newWin=window.open('','newWin','width=300,height=550')}
newWin.document.open()
newWin.document.write(strVml)
newWin.document.close()
newWin.focus()
}
</script>
<style>
td{font-size:11pt}
input{border:solid 1px silver;font-size:9pt;}
</style>
</head>
<body>
<form name=mathForm>
<table cellspacing=0 cellpadding=0>
<tr><td valign=top>
<input type=text name=ee size=2 value=1>y =
<input type=text name=aa size=2 value=1>x</td><td valign=top style="font-size:8pt">3</td>
<td valign=top>
+ <input type=text name=bb size=2 value=1>x</td><td valign=top style="font-size:8pt">2</td>
<td valign=top> +
<input type=text name=cc size=2 value=1>x +
<input type=text name=dd size=4 value=1>
<input type=button value="submit" onclick=resetVml();drawLines()>
</td></tr></table>
</form>
</body>
</html>
댓글목록
등록된 댓글이 없습니다.