Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder StealthRT's Avatar
    Join Date
    Aug 2006
    Posts
    187
    Thanks
    14
    Thanked 0 Times in 0 Posts

    Exclamation Help with figuring out where the error is

    Hey all i am having the hardest time trying to figure out why my code below to input a letter into a textbox does not work when i have the other code enabled
    Code:
    function showKeyCode(){
    			if (document.frmFB.txtWhatStep.value == 'step1')
    			{	
    				if (window.event.shiftKey){
    					if (window.event.keyCode == 50){document.frmFB.txtFName.value = document.frmFB.txtFName.value + '@';};
    					if (window.event.keyCode == 189){document.frmFB.txtFName.value = document.frmFB.txtFName.value + '_';};
    					if (window.event.keyCode == 192){document.frmFB.txtFName.value = document.frmFB.txtFName.value + '~';};
    				}else if (window.event.keyCode >= 65 && window.event.keyCode <= 90 || window.event.keyCode >= 48 && window.event.keyCode <= 57){document.all.txtFName.value = document.all.txtFName.value + String.fromCharCode(event.keyCode);
    				}else if (window.event.keyCode == 8){document.frmFB.txtFName.value = document.frmFB.txtFName.value.slice(0, document.frmFB.txtFName.value.length-1);					
    				}else if (window.event.keyCode == 189){document.frmFB.txtFName.value = document.frmFB.txtFName.value + '-';				
    				}else if (window.event.keyCode == 190){document.frmFB.txtFName.value = document.frmFB.txtFName.value + '.';
    				}else{void(0);}				
    				}
    			}
          document.onkeyup = showKeyCode;
    This is the code that prevents anything to be placed into the textbox.
    Code:
    YCodaSlider.Base.css('style.css');
        jQuery(document).ready(function() {
        	jQuery.ajaxHistory.initialize();
        });
        	jQuery(window).bind("load", function() {
    			window.onkeypress = "";
    			jQuery("#yslider").remove();
    			jQuery("#h3-easeFunc").remove();
    			var options = {};
    			options.id = "yslider";
    			options.height      = parseInt(jQuery.cookie('height')) || 600;
    			options.width       = parseInt(jQuery.cookie('width'))  || 1024;
    			options.scroll      = parseInt(jQuery.cookie('scroll'))   || 0;
    			options.history     = parseInt(jQuery.cookie('history'))  || 0;
    			options.easeTime    = parseInt(jQuery.cookie('easeTime')) || 550;
    			options.easeFunc    = jQuery.cookie('easeFunc') || "easeInOutBack";
    			
    			if(jQuery.cookie('shortcut'))
    				options.shortcut   =  jQuery.cookie('shortcut');
    			else
    				options.shortcut = "37, 39";
    			  
    			var sc = options.shortcut;
    			sc = sc.split(",");
    			jQuery("#option-height").text(options.height);
    			jQuery("#option-easeTime").text(options.easeTime);
    			jQuery("#option-width").text(options.width);
    			jQuery("#option-key1").text(sc[0]);
    			jQuery("#option-key2").text(sc[1]);
    			jQuery("#panel-clone").show();
    			var clone = jQuery("#panel-clone").clone(true);
    			jQuery("#panel-clone").hide();
    			clone.attr("id","panel-target").appendTo("#target"); 
    			jQuery("#panel-target").ycodaslider({
    			id : options.id, 
    			easeTime : options.easeTime, 
    			easeFunc : options.easeFunc, 
    			shortcut : options.shortcut.split(","),
    			height   : options.height,
    			width    : options.width,
    			scroll   : options.scroll,
    			history  : options.history
        	});
    	});
    Once i take that part out, i can type a letter and it will show up in the textbox. But if i keep that code then it wont put anything into it.....!!??!?! Is that code preventing anything to be captured??

    Any help would be great!

  • #2
    Senior Coder rangana's Avatar
    Join Date
    Feb 2008
    Location
    Cebu City, Philippines
    Posts
    1,752
    Thanks
    65
    Thanked 372 Times in 365 Posts
    It seemed like your jquery code removed the function assigned unto your onkeypress event.

    What happens when you comment this part:
    Code:
    jQuery(window).bind("load", function() {
    window.onkeypress = "";
    Learn how to javascript at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph

  • #3
    Regular Coder StealthRT's Avatar
    Join Date
    Aug 2006
    Posts
    187
    Thanks
    14
    Thanked 0 Times in 0 Posts
    Still has the same effect even when i comment that out.

    David


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •