LLD101 Forum Index LLD101
Low Level Dueling in 1.12
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri May 24, 2024 2:37 am
All times are UTC - 8
 Forum index » Off-Topic Section » Off-Topic Discussion
Trade page - any html experts?
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [12 Posts]  
Author Message
lld_master

Joined: 04 Oct 2004
Posts: 412
Offline
0.00 Silvarrr

PostPosted: Sun Jan 22, 2006 10:09 am    Post subject:  Trade page - any html experts?  

Can anyone make me a trade page where I can easily import files and set up trades?

Ill pay in lld currency.
I want something simple for me like a place where I edit the text and the the items and then it displays it for the user with a nice interface.
Back to top
View user's profile Send private message 
ATOMICMAN
Official LLD101 Drunkard


Joined: 01 Mar 2004
Posts: 2740
BNet Acct/Realm: *ATOMICMAN-LLD USEastNL Retired
Offline
0.00 Silvarrr

PostPosted: Sun Jan 22, 2006 10:59 am    Post subject:  

i can prolly do this

but i need alot more infomation and a price (i would rather get paid for time rather than a flat fee, ie per hour/min etc)

i can give you the code or the file to edit yourself but you will have to host it or find someone to host it for you

_________________

I am the bullet in the gun
I am the truth from which you run
I am a silencing machine
I am the end of all your dreams...
Back to top
View user's profile Send private message AIM Address 
lld_master

Joined: 04 Oct 2004
Posts: 412
Offline
0.00 Silvarrr

PostPosted: Sun Jan 22, 2006 1:07 pm    Post subject:  

Ok never mind im doing this myself with an engine a friend gave me. Question is this:

How come Document.openXml(); function of javascript only works with Internet explorer?

I mean I could ask lets say in thr post to use IE, but i wish there was a way around it.... anyone?
Back to top
View user's profile Send private message 
LLD_Pie


Joined: 22 Jun 2004
Posts: 515
Offline
0.00 Silvarrr

PostPosted: Sun Jan 22, 2006 2:35 pm    Post subject:  

post the source... i might be able to fix it.
_________________

Back to top
View user's profile Send private message 
lld_master

Joined: 04 Oct 2004
Posts: 412
Offline
0.00 Silvarrr

PostPosted: Sun Jan 22, 2006 4:27 pm    Post subject:  

function loadXML(xmlFile)
{
xmlDoc.async="false";
xmlDoc.onreadystatechange=verify;
xmlDoc.load(xmlFile);
}
Back to top
View user's profile Send private message 
LLD_Pie


Joined: 22 Jun 2004
Posts: 515
Offline
0.00 Silvarrr

PostPosted: Sun Jan 22, 2006 4:41 pm    Post subject:  

yeah... um... i need the source to Document.openXML() method

or does it just directly call LoadXML(XMLFile)

if thats the case... then just use LoadXML(XMLFile) instead of Document.openXML().......

_________________

Back to top
View user's profile Send private message 
lld_master

Joined: 04 Oct 2004
Posts: 412
Offline
0.00 Silvarrr

PostPosted: Sun Jan 22, 2006 7:01 pm    Post subject:  

var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");

function loadXML(xmlFile)
{
xmlDoc.async="false";
xmlDoc.onreadystatechange=verify;
xmlDoc.load(xmlFile);
}

function verify()
{
if(xmlDoc.readyState!=4)
return false;
}

function traverse(tree)
{
if(tree.tagName == "itemname")
{
document.write("<tr><td>" + tree.text + "<br/>");
}

if(tree.hasChildNodes())
{
var nodes=tree.childNodes.length;
for(var i=0; i<tree.childNodes.length; i++)
{
traverse(tree.childNodes(i));
}
}
}

function initTraverse(file) {
loadXML(file);
var doc=xmlDoc.documentElement;
traverse(doc);
}
Back to top
View user's profile Send private message 
lld_master

Joined: 04 Oct 2004
Posts: 412
Offline
0.00 Silvarrr

PostPosted: Sun Jan 22, 2006 7:02 pm    Post subject:  

it uses: "xmlDoc.load(xmlFile);" to access the file but it isnt supported using Firefox
Back to top
View user's profile Send private message 
LLD_Pie


Joined: 22 Jun 2004
Posts: 515
Offline
0.00 Silvarrr

PostPosted: Sun Jan 22, 2006 7:25 pm    Post subject:  

Code:


Test for Mozilla

Obviously, you will not be coding your XML-based JavaScript application for one particular browser, when you can so easily extend support for other browsers. Yet, the way you code your application will depend on which browser the visitor is using.

To test for Mozilla, we can use a simple variable as follows:

var moz = (typeof document.implementation != 'undefined') && (typeof
document.implementation.createDocument != 'undefined');

The above variable can be used as a boolean variable:

if(moz) {
 // Mozilla!!
} else {
 // Something else...
}

Load the XML File

Once we?ve identified the browser, it's time to load the XML file:

var xmlDoc=document.implementation.createDocument("", "doc", null)
xmlDoc.load("someXMLFile.xml");
xmlDoc.onload = someProcessingFunction;

The first line in the above code creates an instance of the xmlDoc object; the second line loads the XML file we want (someXMLFile.xml, in this case); the third line is used to further process, or manipulate, the XML file we?ve just loaded.

Now, it would be better to create a different function to load the XML file:

var xmlDoc;
function importXML(file) {
 xmlDoc=document.implementation.createDocument("", "doc", null)
 xmlDoc.load(file);
 xmlDoc.onload = readXML;
}

Most of the manipulation techniques used for Mozilla will also work with IE. However, the XML file is loaded differently in each, so let?s look at a function that will load an XML file in Mozilla as well as IE:

var xmlDoc;
function importXML(file) {
 var xmlDoc;
 var moz = (typeof document.implementation != 'undefined') && (typeof
document.implementation.createDocument != 'undefined');
 var ie = (typeof window.ActiveXObject != 'undefined');

 if (moz) {
   xmlDoc = document.implementation.createDocument("", "", null)
   xmlDoc.onload = readXML;
 } else if (ie) {
   xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
   xmlDoc.async = false;
   while(xmlDoc.readyState != 4) {};
 }
 xmlDoc.load(file);
}

The above function can be used to load an XML file for both Mozilla and IE. Now, to load a XML file, the function must be called as:

importXML("YourXMLFile.xml");

Note that the variable ie is used to test for IE. IE uses an ActiveX Object to load an XML file using the Microsoft.XMLDOM object. In the following section, we?ll explore a few methods we can use to access the XML file data.

getElementsByTagName()

The getElementsByTagName method is the most commonly used method available in the XML DOM (Document Object Model) object. As the function's name suggests, this function returns all the elements (or tags) with the given name within the specified element. Basically, it returns an object collection. For example:

var xmlFile = xmlDoc.getElementsByTagName("company");

In the above code, an object collection containing all the <company> elements in the document is stored in the variable xmlFile. Note that the argument you pass to getElementsByTagName() is case-sensitive, i.e. getElementsByTagName("company") is different from getElementsByTagName("ComPanY").

Find the Number of Elements of a Tag

In the XML file illustrated at the beginning of this article, we see exactly one <company> tag. The object collection returned by getElementsByTagName() has a length method that gives the number of elements in the collection. For example, to find the number of <company> tags, the following code is used:

var noOfCompanyTags = xmlDoc.getElementsByTagName("company").length;

Displaying the variable noOfCompanyTags using document.write() will display 1.

Display the Content of a Tag

Again referring to the XML file, suppose we want to display the name of the first employee. Now, the <employee> tag is within the <company> tag; so, first we need to get the collection of all the <company> tags, and through this tag get a collection of all <employee> tags. Let?s take a look at how to display the name step by step:

var companies = xmlDoc.getElementsByTagName("company");

The above code returns an object collection for the <company> tag to the companies variable. Note that companies is an array.

var employees = companies[0].getElementsByTagName("employee");

The above code returns an object collection for the <employee> tag to the employees variable, again in an array. Note the index used in the company variable; this is used because we need to access only the first element of the array. There may only be one <company> tag, but it's still an array, so we use the index 0 to get the element.

To display the name of the first employee, we use the following code:

document.write(employees[0].firstChild.nodeValue);

The above code will display Premshree Pillai. As is clear, employees is a 3-element array. So, to display the name of the second employee, the code would be:

document.write(employees[1].firstChild.nodeValue);

The above code will display Kumar Singh. All the above steps we used to display the employee name (Premshree Pillai) can be integrated into a single code snippet as follows:

document.write(xmlDoc.getElementsByTagName("company")[0].getElementsByTagName("employee")[0]
.firstChild.nodeValue);

Access Tag Attributes

Storing information in XML files in the form of attributes is very common. Consequently, it is important that we are able to access attributes in XML files. In our example XML file, we have stored various employee details, including id, sex, and age, in the <employee> tag. To extract the age of the first employee, we could use the following code:

document.write(employees[0].getAttribute("age"));

The above code will output 20. The code used the getAttribute() method on the employees[0] object. Alternatively, we could use the following code to obtain the same result:

document.write(xmlDoc.getElementsByTagName("company")[0].getElementsByTagName("employee")[0]
.getAttribute("age"));

Now, suppose you want to display the details of all employees (id, sex, age) in a tabular form. To do this, we must loop through all the <employee> tags. Following is the entire code to do this (excluding the code that loads the file):

var companies=xmlDoc.getElementsByTagName("company");
var employees=companies[0].getElementsByTagName("employee");
document.write('<table border="1">');
document.write('<tr><th>id</th><th>Sex</th><th>Age</th></tr>');
for(var i=0; i<employees.length; i++) {
 document.write('<tr>');
 document.write('<td>' + employees[i].getAttribute("id") + '</td>');
 document.write('<td>' + employees[i].getAttribute("sex") + '</td>');
 document.write('<td>' + employees[i].getAttribute("age") + '</td>');
 document.write('</tr>');
}
document.write('<table>');





have fun...

_________________

Back to top
View user's profile Send private message 
lld_master

Joined: 04 Oct 2004
Posts: 412
Offline
0.00 Silvarrr

PostPosted: Sun Jan 22, 2006 7:44 pm    Post subject:  

Ok Ill just post a thing saying USE IE only its too complicated.
Back to top
View user's profile Send private message 
LLD_Pie


Joined: 22 Jun 2004
Posts: 515
Offline
0.00 Silvarrr

PostPosted: Mon Jan 23, 2006 10:06 am    Post subject:  

or just do this

Code:



boolean moz = (typeof document.implementation != 'undefined') && (typeof
document.implementation.createDocument != 'undefined');

if(moz)
{
moz = true;
ie = false;
}
else
{
ie = true;
moz = fals;
}

var xmlDoc;
function importXML(file)
{
 xmlDoc=document.implementation.createDocument("", "doc", null)
 xmlDoc.load(file);
 xmlDoc.onload = readXML;
}

var xmlDoc;
function importXML(file)
{
 var xmlDoc;
 var moz = (typeof document.implementation != 'undefined') && (typeof
document.implementation.createDocument != 'undefined');
 var ie = (typeof window.ActiveXObject != 'undefined');

 if (moz)
{
   xmlDoc = document.implementation.createDocument("", "", null)
   xmlDoc.onload = readXML;
 }
else if (ie)
{
   xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
   xmlDoc.async = false;
   while(xmlDoc.readyState != 4) {};
 }
 xmlDoc.load(file);
}

THIS IS THE IMPORT FUNCTION THAT YOU USE!!

importXML("YourXMLFile.xml");


im pretty sure that iwll work

_________________

Back to top
View user's profile Send private message 
foolZSight


Joined: 23 Nov 2005
Posts: 200
Offline
0.00 Silvarrr

PostPosted: Mon Jan 23, 2006 1:13 pm    Post subject:  

^^
just quick look--the above post should work

o_O its been a while since i tried to code anything though--its a lost hobby for me(yay guitar)

_________________

Back to top
View user's profile Send private message AIM Address 
Display posts from previous:   Sort by:   
Page 1 of 1 [12 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Section » Off-Topic Discussion
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0609s ][ Queries: 40 (0.0055s) ][ GZIP on - Debug on ]