は、私はこのようなASP.NETレイザービューを持っている:テーブル行ごとにキャンバスに描画するJavaScriptを呼び出す方法は?
@{
this.Layout = null;
}
<script type="text/javascript">
function drawWindArrow(canvas, windDirection) {
// Draw something
}
</script>
<table style="width: 100%">
@foreach (var weather in ViewBag.WeatherForecastList)
{
double windDirection = weather.WindDirection;
<tr>
<td>
<canvas width="32" height="32"></canvas>
How can I call drawWindArrow with the canvas and the windDirection as a parameter???
</td>
</tr>
}
</table>
私は、テーブルの行ごとに異なっているキャンバスに何かを描きたいと思います。ここにある矢と似ているはずです:http://www.yr.no/sted/Norge/Oslo/Oslo/Oslo/しかし、CSS3のスタイルに基づいて色を変えて描画する必要があるので、私は静的な画像を使いたくありません。
キャンバスとwindDirectionをパラメータとしてdrawWindArrow JavaScript関数を呼び出すにはどうすればよいですか?
VARをすることができます= document.createElement( "canvas"); https://developer.mozilla.org/ja/Canvas_tutorial/Drawing_shapes –
キャンバスを1つ作成して描画するのは簡単です。しかし、どのように私はそれぞれのテーブルの行ごとに異なるパラメータでこれを行うのですか? – Olav