Jump to content

atrum

Members
  • Posts

    184
  • Joined

  • Last visited

Everything posted by atrum

  1. Just a quick best practices question here. I have noticed that some sites use background-color:#hexcodes for a header background, and others use pixel slivers and just repeat-x on the image. I am not talking about gradients, but solid colors blocks. Personally I think that for a solid color background in let's say a menu header or menu item block it's best to just use the background-color. However I was wondering is there an advantage in using slivers over hex codes?
  2. Thanks for the advice , I am thinking the class might be the best route for this since those have only changed once in the 5 years wow has been out (they added death knights). Not only that but I won't be allowing users to type in their class, they will only be able to select from a pre-compiled list (drop-down). Thanks man, your input is always helpful.
  3. Just want to get peoples opinions on the recommended way to go about this. I am attempting to build a guild management tool using php. (for wow in case your curious) and I want to store the classes, races, and any other static data for use in lists, and other functions. I was thinking of just setting up a static table for classes, but I think that might be a waste of resources. The other way would be to store them all in a static array in a config file. What is the best practice route to take on something like this. I am leaning more towards the config file.
  4. Does anyone know if there is a place on the web where I can find new themes for notepad ++ specifically for javascript syntax highlighting ? The orange and yellow theme that is default hurts the ol'eyeballs, and the other themes just dont look good with javascript.
  5. yeah, its tough learning all the different parts and pieces. im so used to php lol.
  6. Btw, After reviewing that js I used as the example. I see now that it makes no sense (even though it partially works) The new statement that does work is the following var span = document.getElementsByTagName("span"); //set span as an object containing all span objects. var x = span.length; //Set x as the total number of span elements on the page. var i = 0; for(i=0;i<x;i++){ //run a for statement to write out each of the span elements id attribute values. document.write(span[i].id + "<br />"); } I am still curious as to what my original code was doing that caused it to pull those 3 undefined elements.
  7. So, once again I am trying to teach my self javascript. I have run into an output that doesn't make sense (at least to me.) I have a test html form and a test js file. I am just testing out the getElementbyTageName tool, and iterating out each id of the chosen tag name. The element I am after is the span tag. There are 7 of them on the page that I can count (starting from 0 - 6) The output I get includes 3 undefined that I am unable to explain. user_help password_help confirm_password_help email_help confirm_email_help firstname_help lastname_help undefined undefined undefined Please see the code below for specifics. Would any one be able to explain where those undefined items are coming from? //test2.js var span = document.getElementsByTagName("span"); //set span as an object containing all span objects. var x = span.length; //Set x as the total number of span elements on the page. for(x in span){ //run a for statement to write out each of the span elements id attribute values. document.write(span[x].id + "<br />"); } <html> <head> <!-- <script type="text/javascript" src="/js/test.js"></script> --> <link rel="stylesheet" type="text/css" href="/css/test.css" /> </head> <body> <form name="form1" id="form1" action="contact.php" method="post"> <div> <label for="txt_username">User Name: </label> <input type="text" name="txt_username"/> <span id="user_help" class="help"></span> </div> <div> <label for="txt_password">Password: </label> <input type="text" name="txt_password" /> <span id="password_help" class="help"></span> </div> <div> <label for="txt_confirm_password">Confirm Password: </label> <input type="text" name="txt_confirm_password" /> <span id="confirm_password_help" class="help"></span> </div> <div> <label for="txt_email">Email: </label> <input type="text" name="txt_email" /> <span id="email_help" class="help"></span> </div> <div> <label for="txt_confirm_email">Confirm Email: </label> <input type="text" name="txt_confirm_email" /> <span id="confirm_email_help" class="help"></span> </div> <div> <label for="txt_firstname">First Name: </label> <input type="text" name="txt_firstname" /> <span id="firstname_help" class="help"></span> </div> <div> <label for="txt_lastname">Last Name: </label> <input type="text" name="txt_lastname" /> <span id="lastname_help" class="help"></span> </div> <div> <input name="sendData" type="button" value="submit" /> </div> </form> </body> <script type="text/javascript" src="/js/test2.js"></script> </html>
  8. I have been looking into improving my understanding of programing and 3 books were recommended to me. They are all Head First series books. 1. Design Patterns. 2. Object-Oriented Design and Analysis. 3. Software Development. If I wanted to follow a somewhat linear lesson plan in order of need to know first to last. Which book should I start with?
  9. Oh sweet, I never knew about that in firebug. Thanks
  10. Btw, I just found the list for objects on w3schools. but I am still curious if a object dump exists.
  11. Hello again, Just a quick and hopefully simple question in regards to Objects. Is there a way to get an object to show all of its properties and methods? For an example lets use the form object. How do I get the form object to show all of it's properties and methods?
  12. Oh lord, don't get me started on out of date browsers haha.
  13. Just a rant. I work in a web-hosting support job, and the number one thing that bugs me to no end is why customers are so attached to FrontPage extensions. It is a horrible clunky solution to website design and management, and not to mention incredibly outdated. Am I alone on this opinion?
  14. http://www.w3schools.com/jsref/event_onmousemove.asp
  15. hmm, I added alert(form["user_help"]); to the valForm() and it comes up as undefined. function valForm(form){ alert(form["user_help"]); } So I am thinking your right about it not passing in span as part of the form object.
  16. ok, so here is the problem. I have an html form that I am trying to validate and print a message to a span html tag if a field is blank. The issue I am encountering is that nothing gets written to the innerHTML of the span tag id. Heres the mark up. <html> <head> <script type="text/javascript" src="/js/test.js"></script> </head> <body> <form name="form" action="classtest.php" method="post"> <div> <label for="txt_username">User Name: </label> <input type="text" name="txt_username"/> <span id="user_help" class="help"></span> </div> <div> <label for="txt_password">Password: </label> <input type="text" name="txt_password" /> <span id="password_help" class="help"></span> </div> <div> <label for="txt_confirm_password">Confirm Password: </label> <input type="text" name="txt_confirm_password" /> <span id="confirm_password_help" class="help"></span> </div> <div> <label for="txt_email">Email: </label> <input type="text" name="txt_email" /> <span id="email_help" class="help"></span> </div> <div> <label for="txt_confirm_email">Confirm Email: </label> <input type="text" name="txt_confirm_email" /> <span id="confirm_email_help" class="help"></span> </div> <div> <label for="txt_firstname">First Name: </label> <input type="text" name="txt_firstname" /> <span id="firstname_help" class="help"></span> </div> <div> <label for="txt_lastname">Last Name: </label> <input type="text" name="txt_lastname" /> <span id="lastname_help" class="help"></span> </div> <div> <input type="hidden" name="formid" value="id01" /> <input name="sendData" type="button" value="submit" onclick="valForm(this.form)"/> </div> </form> </body> </html> And here is the javascript. function checkEmpty(input, helpText){ if(input.value.length==0){ if(helpText != null){ helpText.innerHTML = "Please enter a value."; return false; } }else{ return true; } } function valForm(form){ //Verify that none of the fields are blank. if(checkEmpty(form["txt_username"], form["user_help"])&& checkEmpty(form["txt_password"], form["password_help"])&& checkEmpty(form["txt_confirm_password"], form["confirm_password_help"])&& checkEmpty(form["txt_email"], form["email_help"])&& checkEmpty(form["txt_confirm_email"], form["confirm_email_help"])&& checkEmpty(form["txt_firstname"], form["firstname_help"])&& checkEmpty(form["txt_lastname"], form["lastname_help"])){ //Submit the form. form.submit(); }else{ //Display the error. alert("shit broke"); } } I am using firebug to help me find any errors, but that's the other problem is that it says there are no errors. The page I am using can be accessed at this URL: http://icca.exiled-alliance.com/test.php When you click submit and any of the fields are blank, I have an alert box pop up to say the script shit the bed. and I have gotten an alert to pop up for each input that is blank as well. Just the innerHTML is giving me trouble. Any help any one can offer would be appreciated. Thanks, Atrum.
  17. Thanks for the reply every one. And thank you for the simple explanation pikachu2000. This just fixed a lot of my scripts hehe.
  18. Ok, I am sure you have all come across this error before. I am trying to understand why this occurs in a straight forward (spelled out for the complete dumb ass) kind of way. I made the most simple script I could come up with that would produce the error, but I am still uncertain as to what causes it, or what the fix is. Here is the script. Using all the letters and numbers available I print the total characters in the string, run a for statement to print out each character in order from the string index, and get the error "Undefined String Offset 36". Which is the total number of characters in the string starting at 0. The test script can be accessed at the following url: http://icca.exiled-alliance.com/classtest.php $test = "abcdefghijklmnopqrstuvwxyz1234567890"; $b = "<br />"; echo $test; echo $b; echo "There are " .strlen($test). " characters in the above string"; echo $b; for($x=0;$x<=strlen($test);$x++){ echo $test[$x]. "-->number $x"; echo $b; } Can anyone clear up why that error pops up from the way I have this scripted.
  19. So I have been around the net a few times reading tutorials, watching vids as I try to teach my self php. I have come across a few items that I am having trouble understanding. The first is the use of the % symbol. For example I commonly see the % used in generating random strings of characters. Here is piece of the code I used to generate a random string. What is the purpose of % in this statement. if ($alt == 1) { $rndPKID .= $consonants[(rand() % strlen($consonants))]; $alt = 0; } else { $rndPKID .= $vowels[(rand() % strlen($vowels))]; $alt = 1; } The second is the use of the & or as it is better known. The ampersand symbol. I commonly see it used when declaring a function. function newfunction($var1, &$var2){ //Do Stuff Here. } Can anyone help me understand those 2 symbols purpose and usage in php?
  20. I'm half awake so I may have missed something, or maybe it just feels like it. btw I assumed the array was $_POST. foreach($_POST as $key => $value){ echo "<input name=\"$key\" value=\"$value\" type='text' size='12' maxlength='5' />"; } If that's wrong, someone please help this guy that knows what they are doing haha.
  21. So you just want to get the values from an array and for each one display an text input with the values of the array?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.