By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,769 Members | 1,151 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,769 IT Pros & Developers. It's quick & easy.

XUL/Javascript problem

P: 1

I have 2 xul files (welcome and main) and 1 javascript file. the js file is declared in both xul files.

In the javascript file i have a 'player' class which at the moment has only getname and setname functions with a name variable. I have instantiated the class at the bottom of the file:
var thePlayer = new CPlayer();
What im currently doing in the welcome.xul file is saving the name the player enters by calling the setname function (in the js file):
playerName = document.getElementById("playername").value;
So it works up to here. playerName holds whatever was entered in the 'playername' box in the calling welcome.xul file.

Now i want the main.xul file to display the players name but it says that it is unreferenced. Im fairly certain this is because i have included the js file in each xul file so each one has its own instance of the CPlayer class..

My question it possible to get both xul files to share 1 instance? or would i have to instantiate the object in the welcome.xul file and pass it around...

Feb 23 '07 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 15k+
P: 16,027
Welcome to The Scripts.

I'm not too familiar with XUL files, but this might help.
Feb 26 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.