0
我有以下问题,如果我做它的函数someone.listen_request()
里面给出我file.xul
使用DOM方法来访问一个元素访问XUL元素。麻烦从JavaScript
但如果我这样做了progress_bar()
函数内部它工作正常。
谁能帮助我在这种情况下。
我的代码:
// Listening to an event from a php/html file
var someone =
{
listen_request: function()
{
document.addEventListener("record-id", function(event)
{
var node = event.target, doc = node.ownerDocument;
var d=node.getUserData("data");
var str=d.split(",");
var text=str[0];
var record_id=str[1];
var field_id=str[2];// Working fine till here
// **this is not working**
document.getElementById("Telephone2").value="helo";
}, false, true);
}
}
someone.listen_request();
// Called at onLoad and onBlur..
function progress_bar(len,page_values)
{
// **here it is working fine**
document.getElementById("Telephone2").value="helo";
var filed_cnt=0;
var tot_rows=0;
for(i=0;i<len;i++)
{
if(page_values[i]!="")
{
filed_cnt+=parseInt(1);
}
}
var compeletion= (filed_cnt/len)*100;
var complete=Math.round(compeletion);
document.getElementById("pbar").value=complete;
document.getElementById("meter").value=complete;
}
“有问题” 是不是说明 - 什么错误信息是你越来越?按Ctrl-Shift-J查看错误控制台。 –
感谢您回复弗拉基米尔帕兰特。但在javascript错误控制台中没有错误消息。我想说document.getElementById(“Telephone2”)。value =“helo”;不工作inseid功能someone.listen_request(),但同时两个功能都在同一页上,它正在以功能progress_bar()很好..。 – Himanshu
然后代码根本不运行。如果它运行但在中间停下来,那么一定有一个例外。 –