Click here to Skip to main content
15,891,529 members
Home / Discussions / JavaScript
   

JavaScript

 
GeneralRe: showmodaldialog return value undefined across domain Pin
Amr M. K.6-Aug-12 22:05
Amr M. K.6-Aug-12 22:05 
AnswerRe: showmodaldialog return value undefined across domain Pin
BobJanova5-Aug-12 23:43
BobJanova5-Aug-12 23:43 
GeneralRe: showmodaldialog return value undefined across domain Pin
Amr M. K.6-Aug-12 21:26
Amr M. K.6-Aug-12 21:26 
QuestionEvalulating and passing RGB values from keydown Pin
jkirkerx2-Aug-12 8:12
professionaljkirkerx2-Aug-12 8:12 
AnswerRe: Evalulating and passing RGB values from keydown Pin
enhzflep2-Aug-12 9:58
enhzflep2-Aug-12 9:58 
GeneralRe: Evalulating and passing RGB values from keydown Pin
jkirkerx2-Aug-12 11:54
professionaljkirkerx2-Aug-12 11:54 
AnswerRe: Evalulating and passing RGB values from keydown Pin
BobJanova5-Aug-12 23:31
BobJanova5-Aug-12 23:31 
GeneralRe: Evalulating and passing RGB values from keydown Pin
jkirkerx6-Aug-12 7:22
professionaljkirkerx6-Aug-12 7:22 
I found that out on testing, what a mess. So far so good, but I need to go back and fix control v and control c, for pasting in values.

So I did filter the keystokes, and then ran the validation on the update image button, when you work with rgb, I update the hex, update the hex, I update the rgb, and the sample color swatch.

Ended up with this so far, without the copy and paste functionality. I need to go back and add that. Still testing the full functionality, and taking note of any errors.

My validate_HEX is not working right, I need to check the regex, or my use of .test is not correct.

Tell me what you think. I'm getting better at writing javascript.

Oh, Thanks for your comment, I pretty much got crickets on this one.

function evaulateKeyDown_RGB(e, targetObj) {

    // Delete = 46 | BS = 8 | 0 = 48 | 9 = 57 | < = 37 | > = 39
    // Delete = 46 | BS = 8 | 0 = 96 | 9 = 105 | < = 37 | > = 39
    var charArray = [8, 9, 17, 18, 37, 39, 46, 48, 49, 50, 51, 52, 53, 54,
    55, 56, 57, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105];
    
    var charCode = parseInt(e.keyCode || e.which);        
    for (var i = 0; i < charArray.length; i++) {
        if ((charCode != NaN) && (charArray[i] == charCode)) {
           return true
        }
    }
    return false;   
}

function evaulateKeyDown_HEX(e, targetObj) {
    
    // Delete = 46 | BS = 8 | 0 = 48 | 9 = 57 | < = 37 | > = 39
    // Delete = 46 | BS = 8 | 0 = 96 | 9 = 105 | < = 37 | > = 39
    var charArray = [8, 9, 17, 18, 37, 39, 46, 65, 66,
    67, 68, 69, 70, 97, 98, 99, 100, 101, 102,
    48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
    96, 97, 98, 99, 100, 101, 102, 103, 104, 105];
   
    var charCode = parseInt(e.keyCode || e.which);
    for (var i = 0; i < charArray.length; i++) {
        if ((charCode != NaN) && (charArray[i] == charCode)) {
            return true
        }
    }
    return false;    
}

function validate_RGB(targetObj) {

    // Check if the whole value is 0-255
    var charFlag = false;
    var value = parseInt(targetObj.val());
    if ((value != NaN) && (value <= 255)) {
        targetObj.css("border", "solid 1px rgb(140,140,140)"); 
        return true;
    }
    else {
        targetObj.focus().select();
        targetObj.css("border", "solid 1px rgb(255,0,0)");
        return false;      
    }
}

function validate_HEX(targetObj) {

    var hValue = targetObj.val();
    var regColorcode = /^(#)?([0-9a-fA-F]{3})([0-9a-fA-F]{3})?$/;
    if (regColorcode.test("#"+hValue) == false) {
        targetObj.focus().select();
        targetObj.css("border", "solid 1px rgb(255,0,0)");
        return false;
    }
    else {
        targetObj.css("border", "solid 1px rgb(140,140,140)"); 
        return true;
    }
}

GeneralRe: Evalulating and passing RGB values from keydown Pin
BobJanova7-Aug-12 0:11
BobJanova7-Aug-12 0:11 
GeneralInstalling Pygame Pin
johtnkucz30-Jul-12 4:36
johtnkucz30-Jul-12 4:36 
GeneralRe: Installing Pygame Pin
johtnkucz30-Jul-12 4:45
johtnkucz30-Jul-12 4:45 
QuestionRe: Installing Pygame Pin
Richard MacCutchan30-Jul-12 6:14
mveRichard MacCutchan30-Jul-12 6:14 
AnswerRe: Installing Pygame Pin
Sandeep Mewara31-Jul-12 8:56
mveSandeep Mewara31-Jul-12 8:56 
GeneralRe: Installing Pygame Pin
Richard MacCutchan31-Jul-12 22:32
mveRichard MacCutchan31-Jul-12 22:32 
QuestionAnalysing an obfuscated malware script Pin
Bernhard Hiller29-Jul-12 21:48
Bernhard Hiller29-Jul-12 21:48 
AnswerRe: Analysing an obfuscated malware script Pin
Richard MacCutchan29-Jul-12 22:00
mveRichard MacCutchan29-Jul-12 22:00 
GeneralRe: Analysing an obfuscated malware script PinPopular
enhzflep30-Jul-12 1:43
enhzflep30-Jul-12 1:43 
GeneralRe: Analysing an obfuscated malware script Pin
Bernhard Hiller30-Jul-12 4:48
Bernhard Hiller30-Jul-12 4:48 
GeneralRe: Analysing an obfuscated malware script Pin
enhzflep30-Jul-12 23:41
enhzflep30-Jul-12 23:41 
GeneralRe: Analysing an obfuscated malware script Pin
Bernhard Hiller31-Jul-12 2:26
Bernhard Hiller31-Jul-12 2:26 
GeneralRe: Analysing an obfuscated malware script [edit] Pin
Lutosław1-Jun-13 4:10
Lutosław1-Jun-13 4:10 
GeneralRe: Analysing an obfuscated malware script Pin
jkirkerx30-Jul-12 11:19
professionaljkirkerx30-Jul-12 11:19 
GeneralRe: Analysing an obfuscated malware script Pin
enhzflep30-Jul-12 23:40
enhzflep30-Jul-12 23:40 
GeneralRe: Analysing an obfuscated malware script Pin
jkirkerx31-Jul-12 8:12
professionaljkirkerx31-Jul-12 8:12 
GeneralRe: Analysing an obfuscated malware script Pin
enhzflep31-Jul-12 9:57
enhzflep31-Jul-12 9:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.