...

View Full Version : Help with figuring out where the error is



StealthRT
09-13-2008, 01:06 AM
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


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.


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!

rangana
09-13-2008, 02:16 PM
It seemed like your jquery code removed the function assigned unto your onkeypress event.

What happens when you comment this part:


jQuery(window).bind("load", function() {
window.onkeypress = "";

StealthRT
09-13-2008, 08:14 PM
Still has the same effect even when i comment that out.

David



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum