Jump to content

Beta

Members
  • Posts

    30
  • Joined

  • Last visited

Previous Fields

  • Languages
    Basic Javascript. ;p

Contact Methods

  • Website URL
    http://
  • ICQ
    0

Beta's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. function XHR() { var _handler; if(window.XMLHttpRequest) { _handler = new XMLHttpRequest(); } else if(window.ActiveXObject) { try { _handler = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { _handler = new ActiveXObject("Microsoft.XMLHTTP"); } } return _handler;}function startup() { var xmlHttp; xmlHttp = XHR(); xmlHttp.onreadystatechange = stateChanged; xmlHttp.open("POST", "bringmethedata.php", true); xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlHttp.send("");} function stateChanged() { if(xmlHttp.readyState == 4 && xmlHttp.status == 200) { document.getElementById("letPHPdothework").innerHTML = xmlHttp.responseText; }} Why are use using the POST method, yet sending no parameters? o.o
  2. Well, i've seen my fair share of people complain about crossbrowser compatibility. And, they always have their own ways of checking for IE. Whether it be the ActiveXObject, or even the document.all...maybe even an appName check...So, how do you check?For me, i'm trying to use this more often: function isIE() { if((new Array()).__proto__ != Array.prototype) { return true; } else { return false; }} hehehehehehe
  3. http://www.javascriptkit.com/javatutors/co...alcompile.shtml'...Include comment tags in your script in a way that ensures browser compatibility..."
  4. Actually, use the global and multiline flags on this./regexpstuff/gim; that might solve your problem...o_O
  5. For telephone numbers, it's different. You would need to match either(#)? ### ### ####or### ####So, it would be along the lines of ((\d{1}\s)?(\d{3})?\d{3}\s\d{4}Atleast, i think that's how it would be done :/By the way, i was wondering about your lines.you have \s{2,*}...would that match for only 2 spaces in the entire string, or only 2 spaces in a row...?
  6. Yes, and while i don't normally use Wikipedia, they have a nice reference to most of the characters included in Regular Expressions http://en.wikipedia.org/wiki/Regular_Expressions
  7. To check for something to appear more than once, doesn't a simple {#} work? Where # = the number of occurences you want to check for.\s{2} would check for 2 whitespaces i think
  8. Beta

    30 day timeout

    Then use something other than a database Such as FF's globalStorage and IE's userData. Or you could have a webpage with keys and values that are auto-generated according to the user's persistent data value
  9. Beta

    30 day timeout

    Yes, but thats why you create two encryption functions that need keys to operate The keys are stored in a small database, then accessed via AJAX and used to decrypt the cookie and eval the main function :)Each encryption has a different key used to decrypt it
  10. Beta

    30 day timeout

    Just add a cookie that expires in 30 days, then have the script check for it:p Have the cookies name and value encrypted so that the user cant cheat and make another one though...lol
  11. Instead of making them equal to each other like your doing, why not create a prototype type function for that object that copies the values of one object, to the other?function Object() {blah}Object.prototype.copy = function(obj) {blah obj blah}var 1 = new Object();var 2 = new Object();1.copy(2);
  12. i see pulpfictions going to answer this one...so ill just add something :)Instead of using the full document.getElementById(id);, you can use shorthand functions or variables :)var getID = document.getElementById;orfunction getID(id) { return document.getElementById(id);}to use either, its:getID("id");
  13. use Arrays :)have a list of arrays like this: var Menu = new Array();Menu[0] = ["1", "2", "3", "4", "5"];Menu[1] = ["1", "2", "3", "4", "5"];Menu[2] = ["1", "2", "3", "4", "5"];function MenuClick(menu) { var List = document.getElementById("model"); for(var a = 0; a < List.getElementsByTagName("option").length; a ++) { List.getElementsByTagName("option")[a].innerHTML = Menu[num][a]; }}<option onclick="MenuClick(0);">Type 1</option> Something like that should work...although you may want to tidy it up, and make it more...well...useful and bigger..loli think you can also put arrays inside arrays:Menu[0] = [["0 innerHTML", "0 other stuff"], ["1 innerHTML", "1 other stuff"]];then have Menu[menu][a][0] or Menu[menu][a][1]
  14. Yea, i see where your coming from, and that's most likely the best method, as all of your scripts are in the head element. But i like to just keep the function inside one script tag rather than create another one to execute it, or using window.onload and setTimeout :)Also, most of my functions execute themselves So i cant really do it later on in the pages source
  15. You could, but it's easier to load it after :)Atleast, i think so
×
×
  • Create New...