...

View Full Version : User sets variables



thesmart1
05-08-2006, 03:43 AM
Is there any way to use several text fields to allow a user to set variables to be implemented later on in the page?

If so, is there a way to put the variables into groups using document.write() strings and alphabetize these by the first variable in them?

Kor
05-08-2006, 09:56 AM
can u detail your aim? can you give us an algorithm of what you need?

thesmart1
05-10-2006, 03:35 AM
The user types words in a set of text fields. These words are assigned to javascript variables. I would display these variables on the page using document.write() strings. If possible, the document.write() strings would also be alphabetized by the first variable.

Kravvitz
05-10-2006, 04:36 AM
You can't use document.write() like that. (http://developer.mozilla.org/en/docs/DOM:document.write#Notes)

You should learn about the DOM, which can be used to do things like that.

JavaScript tutorial - W3C DOM introduction (http://www.howtocreate.co.uk/tutorials/javascript/domintroduction)
http://www.quirksmode.org/dom/
http://www.quirksmode.org/js/dom.html
http://www.brainjar.com/
http://developer.apple.com/internet/webcontent/dom2i.html
http://www.mozilla.org/docs/dom/domref/dom_doc_ref.html
http://www.mozilla.org/docs/dom/domref/
http://www.w3schools.com/htmldom/dom_obj_document.asp
http://www.sitepoint.com/article/rough-guide-dom
http://developer.mozilla.org/en/docs/Gecko_DOM_Reference
http://digital-web.com/articles/forms_usability_and_the_w3c_dom/
http://www.w3.org/DOM/

CrAzY_J
05-10-2006, 04:48 AM
put them in a array, sort them, loop through the array and append the text to a div or w/e.




var the_array = [];
the_array.push(your_variables);
the_array.sort();
for(var s=0;s<the_array.length;s++){
document.getElementById('someid').appendChild(document.createTextNode(the_array[s]));
}


something like that.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum