What is wrong with this code?
[CODE]function reportit_createobj() {
var popupobj = document.createElement(“object”);
popupobj.setAttribute(“id”, “reportit_popup”);
popupobj.setAttribute(“type”, “text/html”);
popupobj.setAttribute(“style”, “display: none; position: fixed; top: 100px; left: 100px; background: #ccc; height: 100px; width: 400px; padding: 5px; border: 1px solid #000;”);
popupobj.setAttribute(“data”, “script.php?id=0”);
popupobj.innerHTML = “<p>ReportIt! Interface</p>”;
document.body.appendChild(popupobj);
}
window.onload = function() { reportit_createobj(); };
function reportit_popup(id) {
var popup = document.getElementById(“reportit_popup”);
if(popup.style.display == “block”) {
popup.style.display = “none”;
} else {
popup.setAttribute(“data”, “script.php?id=” + id);
popup.style.display = “block”;
}
}
This is how I use it:
[CODE]<a href=”javascript:void(0)” onClick=”reportit_popup(1)”>popup</a>
It seems like it should work. It’s fairly straightforward. But it’s not working. It doesn’t do anything when I click on the link. Plus, the Web Developer Toolbar in Firefox gives me this error:
[CODE]Error: uncaught exception: [Exception… “Component is not available” nsresult: “0x80040111 (NS_ERROR_NOT_AVAILABLE)” location: “JS frame :: http://localhost/2008/04/hello-world/ :: onclick :: line 1” data: no]
Any help would be super! ?