In trying to create a browser object (which parses XML data and displays it in a ‘Finder’-esque manner) I’ve stumbled across a problem which I’m unable to solve. When I was trying to test the object Firebug kept giving me “Browser is not a constructor”.
The code that called the object constructor is as follows:
[CODE]
var b = new Browser(‘b’, ‘test’, ‘/runtime/browserdatacollections.php?sort=category’);
and the code for the actual constructor itself (I haven’t included any properties) is:
[CODE]
function Browser(id, title, url) {
/*
Browser Object
Creates a browsing GUI for browsing files/collections/artwork et cetera. Starts hidden.
Properties
id : object id, must be the same as the name given to the variable calling it.
title : the title to be displayed (optional).
url : the data feed url.
Methods
toggleWindow : shows/hides the window
get_data : retrieves the data from the url specified.
write_data : parses and writes the data to the browser window.
open : performs all actions to open the browser window/display data.
show : shows the browser window.
hide : hides the browser window.
*/
this.id = id;
this.title = title;
this.url = url;
//Wrapper
document.write(“<div id='” + this.id + “_wrapper’></div>)”);
this.wrapper = $(‘wrapper’);
//Structure
this.titlebar = document.createElement(“div”);
this.titlebar.className = “browser_titlebar”;
this.wrapper.appendChild(this.titlebar);
this.titlebar.innerHTML = “<h1>” + this.title + “</h1>”;
this.browser = document.createElement(“div”);
this.browser.className = “browser_browseWindow”;
this.wrapper.appendChild(this.browser);
}
Any help would be very much appreciated since this is an annoying obstacle.