Click here to Skip to main content
15,889,462 members
Home / Discussions / JavaScript
   

JavaScript

 
Questiononkeypress event is not working google chrome Pin
Mithra Madhu25-Nov-13 20:36
Mithra Madhu25-Nov-13 20:36 
QuestionRe: onkeypress event is not working google chrome Pin
ZurdoDev6-Dec-13 10:28
professionalZurdoDev6-Dec-13 10:28 
Questionrestrict file type and size of form upload javascript only Pin
vbslacker24-Nov-13 8:37
vbslacker24-Nov-13 8:37 
AnswerRe: restrict file type and size of form upload javascript only Pin
Snehasish_Nandy24-Nov-13 20:06
professionalSnehasish_Nandy24-Nov-13 20:06 
AnswerRe: restrict file type and size of form upload javascript only Pin
abdul0425-Nov-13 23:53
abdul0425-Nov-13 23:53 
Question[Javascript] Find unused funtions and variables in Javascript using VS2010 Ultimate Pin
Member 1041144619-Nov-13 2:47
Member 1041144619-Nov-13 2:47 
AnswerRe: [Javascript] Find unused funtions and variables in Javascript using VS2010 Ultimate Pin
thatraja19-Nov-13 3:16
professionalthatraja19-Nov-13 3:16 
QuestionHaving a Problem with Return Value in Javascript Function Pin
Doug Pruiett12-Nov-13 16:25
Doug Pruiett12-Nov-13 16:25 
I am having a dickens of a time getting a particular function to behave properly. This is client-side script. I find that I have to enclode the variable to be returned in parenthesis, or the function will not run at all. However, the calling routine chokes on the return and never gives the value passed back. WHY would I have to put parenthesis around the return variable (e.g., Return (VName);) in order for my function to run. WHAT am I doing wrong (I am new to JavaScript). Here is the code. I never get to the second alert.

JavaScript
function SetFund(){
    alert('1');
    var FundVal = GetFundValue();
    alert('2');
}
function GetFundValue() {
    var FundVal = '143';
    //Get the referrer (if there is one)
    var strRef = document.referrer;
    if (strRef == '')
    {
        Return(FundVal);
    }
    else
    {
        //Extract the jurisdiction from the calling URL (if it is there)
        strRef=strRef.replace('http://','');
        strRef=strRef.replace('https://','');
        var i =strRef.indexOf('/');
        strRef=strRef.substr(i+1);
        strRef=strRef.replace(new RegExp('/', 'g'),'');
        strRef=strRef.replace(new RegExp('-', 'g'),'');
        //Get the ID of the element containing the fund selections
        var FDID = GetDesigID();
        //Resolve the ID into an element that can be referenced
        var  fdes =  document.getElementById(FDID);
        //Grab the list of funds and their descriptions.  Remove unnecessary formatting
        var strTmp=fdes.innerHTML.replace(new RegExp('<option value="', 'g'),'');
        var strTmp=strTmp.replace(new RegExp('<option selected="selected" value="', 'g'),'');
        var strTmp=strTmp.replace(new RegExp(' ', 'g'),'');
        //Remove the special characters
        var strTmp=strTmp.replace(new RegExp(String.fromCharCode(9), 'g'),'');
        var strTmp=strTmp.replace(new RegExp(String.fromCharCode(10), 'g'),'');
        var strTmp=strTmp.replace(new RegExp('">', 'g'),',');
        strTmp=strTmp.toLowerCase();
       //Split the funds into an array
        var strHTML = strTmp.split('</option>');
        for(var i = 0; i < strHTML.length; i++)
        {
            var FundValuePair = strHTML[i].split(',');
            if(FundValuePair[1].indexOf(strRef) > 0){
                FundVal = FundValuePair[0];
                Return(FundVal);
            }
        }
        Return(FundVal);
    }
}

AnswerRe: Having a Problem with Return Value in Javascript Function Pin
Graham Breach12-Nov-13 22:44
Graham Breach12-Nov-13 22:44 
GeneralRe: Having a Problem with Return Value in Javascript Function Pin
Doug Pruiett13-Nov-13 3:30
Doug Pruiett13-Nov-13 3:30 
GeneralRe: Having a Problem with Return Value in Javascript Function Pin
Graham Breach13-Nov-13 5:27
Graham Breach13-Nov-13 5:27 
AnswerRe: Having a Problem with Return Value in Javascript Function Pin
Doug Pruiett13-Nov-13 4:19
Doug Pruiett13-Nov-13 4:19 
GeneralRe: Having a Problem with Return Value in Javascript Function Pin
Richard Deeming13-Nov-13 4:51
mveRichard Deeming13-Nov-13 4:51 
GeneralRe: Having a Problem with Return Value in Javascript Function Pin
Richard MacCutchan13-Nov-13 6:10
mveRichard MacCutchan13-Nov-13 6:10 
SuggestionRe: Having a Problem with Return Value in Javascript Function Pin
chxm199016-Nov-13 3:30
chxm199016-Nov-13 3:30 
QuestionShowing Questions Below Answers After The Submit Button Is Pressed? Pin
KeonD12311-Nov-13 10:25
KeonD12311-Nov-13 10:25 
AnswerRe: Showing Questions Below Answers After The Submit Button Is Pressed? Pin
twseitex12-Nov-13 3:19
twseitex12-Nov-13 3:19 
QuestionHidden field value in javascript Pin
vkEE11-Nov-13 5:12
vkEE11-Nov-13 5:12 
AnswerRe: Hidden field value in javascript Pin
twseitex12-Nov-13 3:27
twseitex12-Nov-13 3:27 
GeneralRe: Hidden field value in javascript Pin
Kornfeld Eliyahu Peter12-Nov-13 19:19
professionalKornfeld Eliyahu Peter12-Nov-13 19:19 
GeneralRe: Hidden field value in javascript Pin
vkEE3-Dec-13 10:35
vkEE3-Dec-13 10:35 
GeneralRe: Hidden field value in javascript Pin
Amir Hamza Md. Kayes6-Dec-13 9:16
professionalAmir Hamza Md. Kayes6-Dec-13 9:16 
QuestionScript to determine the optimal weight man Pin
bosko18-Nov-13 1:11
bosko18-Nov-13 1:11 
SuggestionRe: Script to determine the optimal weight man Pin
Richard MacCutchan8-Nov-13 1:27
mveRichard MacCutchan8-Nov-13 1:27 
GeneralRe: Script to determine the optimal weight man Pin
bosko18-Nov-13 9:47
bosko18-Nov-13 9:47 

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.