目前遇到了個問題
我在html 撰寫過程中 想要呼叫從python 帶過來的參數
return render_template('productshare.html'ProductImage= pic, PictureLenth=PictureLenth)
PictureLenth 是pic 陣列長度
想透過兩三秒執行一次函式來達到幻燈片效果
不過
{{ }}裡面不認我"now"這個變數
請問各位高手有什麼更好的方法嗎??
lenth = {{ PictureLenth }}-1;
now = 0;
function t_setInterval() {
window.intervalParam = window.setInterval(function() {
var date = new Date();
if (lenth>now)
{now = now + 1;}
else
{now = 0;}
var img = document.getElementById("image");
img.src="data:image/png;base64, {{ ProductImage[now] }}";
return false;
}, 4000);
}
--
這是 Google 網上論壇針對「python.tw」群組發送的訂閱通知郵件。
如要取消訂閱這個群組並停止接收來自這個群組的郵件,請傳送電子郵件到 pythontw+u...@googlegroups.com。
如要在這個群組張貼留言,請傳送電子郵件到 pyth...@googlegroups.com。
請前往以下網址造訪這個群組:http://groups.google.com/group/pythontw。
如需更多選項,請前往:https://groups.google.com/d/optout。
img.src="data:image/png;base64, {{ ProductImage[0] }}".. img.src="data:image/png;base64, {{ ProductImage[n] }}"