我试图通过URL传递java脚本变量值,而URL用于加载i-frame这里我的代码
var child_id = 4;
$(newelement).html('<iframe id="becky_bunnyQ1" style="width:92%;height:100%;display:block;position:absolute;border: none;padding-left: 4%;" scrolling="no" src="pages/page20/index.html?id="'+child_id+'></iframe>');
答案 0 :(得分:1)
设置src
属性时出错。应该是:
$(newelement).html('<iframe id="becky_bunnyQ1"
style="width:92%;height:100%;display:block;position:absolute;border:
none;padding-left: 4%;" scrolling="no"
src="pages/page20/index.html?id='+child_id+'"></iframe>');