Search Results

Search found 4 results on 1 pages for 'neitony'.

Page 1/1 | 1 

  • Javascript code refactoring and assessment

    - by neitony
    I'm using javascript to toggle the display state of some objects based on the time of day. A sample of the code is given below. I was wondering if anyone could give a suggestion as to how I can refactor this code while at the same time improving the logic. switch(tcode) { case 'eur' : eur.setAttribute('style', 'display:block; opacity:0.5'); us.style.display = 'none'; asia.style.display = 'none'; us_inactive.style.display = 'block'; asia_inactive.style.display = 'block'; break; case 'us' : us.style.display = 'block'; eur.style.display = 'none'; asia.style.display = 'none'; eur_inactive.style.display = 'block'; asia_inactive.style.display = 'block'; break; case 'asia' : asia.setAttribute('style', 'display:block; opacity:0.5'); us.style.display = 'none'; eur.style.display = 'none'; eur_inactive.style.display = 'block'; us_inactive.style.display = 'block';

    Read the article

  • Refactoring and assessment

    - by neitony
    I'm using javascript to toggle the display state of some objects based on the time of day. A sample of the code is given below. I was wondering if anyone could give a suggestion as to how I can refactor this code while at the same time improving the logic. switch(tcode) { case 'eur' : eur.setAttribute('style', 'display:block; opacity:0.5'); us.style.display = 'none'; asia.style.display = 'none'; us_inactive.style.display = 'block'; asia_inactive.style.display = 'block'; break; case 'us' : us.style.display = 'block'; eur.style.display = 'none'; asia.style.display = 'none'; eur_inactive.style.display = 'block'; asia_inactive.style.display = 'block'; break; case 'asia' : asia.setAttribute('style', 'display:block; opacity:0.5'); us.style.display = 'none'; eur.style.display = 'none'; eur_inactive.style.display = 'block'; us_inactive.style.display = 'block';

    Read the article

  • Restricting numeric input javascript problem

    - by neitony
    I'm trying to figure out why my javascript code is not restricting numeric input. Here's the code below: (function(){ if(window.addEventListener) window.addEventListener("load",init,false); else if(window.attachEvent) window.attachEvent("onload",init); function init() { var keytest = document.getElementById("keytest"); function numericinput(event) { var e = event || window.event; var key = e.charcode || e.keyCode; var regex =/^\d+\.?\d{4}$/; key = String.fromCharCode(key); if (!regex.test(key)) { alert("something"); //if(e.preventDefault) e.preventDefault(); //if(e.returnValue) e.returnValue = false; //return false; } else { //return true; alert("something else"); } } if(keytest.addEventListener) keytest.addEventListener("keypress",numericinput,false); else { keytest.onkeypress = numericinput(); } } })();

    Read the article

  • The importance of knowing c++ for web application development

    - by neitony
    I'm a php developer and I want to broaden my knowledge base by learning a higher language (java, c#, c++). My specialty is in building web applications (ria etc). I'm trying to think of the appropriate path to take (hedging my bets so to speak) in terms of which language I should be focusing on. I love open source technology but at the same time C# seems to be getting a lot of notoriety. Despite the newer technologies available there still remains c++ which is the staple for many popular vendors including google and facebook (hip hop) in building scalable and robust cross platform apps. Can anyone offer suggestions as to how I should be looking at this. Should I go Java, C# or C++). They all take time to master and I just want to choose a specialty. Thanks

    Read the article

1