您好,我試圖從html中的文本框中獲取值,並將其賦給for循環中的i,但我的程序沒有作品:我想從文本框中獲取一個值,並將其放入我的for循環中
var k = document.getElementById(「textbox1」).value;
for (var i = k; i < n; i+=4) {
//for (var j = 0; j < n; j+=4) {
pixelComponents[i ] = pixelComponents[i ] + 100; //red
pixelComponents[i+1] = pixelComponents[i+1]+0; //green
pixelComponents[i+2] = pixelComponents[i+2]+0; //blue
//}
}
而且我嘗試這樣做,它不會太工作:
for (var i = document.getElementById("textbox1").value;; i < n; i+=4) {
//for (var j = 0; j < n; j+=4) {
pixelComponents[i ] = pixelComponents[i ] + 100; //red
pixelComponents[i+1] = pixelComponents[i+1]+0; //green
pixelComponents[i+2] = pixelComponents[i+2]+0; //blue
//}
}
wwhat爲n這裏我