/    Sign up×
Community /Pin to ProfileBookmark

Javascript question on "onclick"

I can’t get around this javascript..
basically what it does is..
when user doen’t select the item from combobox it will pop up the msg. or he/she select the file, it will take him to next page..

<SCRIPT LANGUAGE=”JavaScript”>
<!–
function CheckName()
{
with ( window.document.forms[0] )
{
if (cboforth.value.length == 0)

{
alert (“Please select a study name”);
return false;
}
}
return true;
}

function someFunction(this) {
if (window.document.form.cboforth) {
window.open(‘sTudy_Detail.asp?strfildisplyename=<%=Server.URLEncode(strFith)%>’, ‘_self’);
} else {
CheckName();
}
}

–>

<input type=”button” name=”Button” value=”More Information” onclick=”someFunction(this);”>

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@steelersfan88Mar 09.2004 — 
  • 1. this is not your entire code, that might be helpful

  • 2. you didn't close your script tags, that would cause the code to become commented lines.

  • 3. you named your function poorly, and your code isn't readable (use the PHP tags), the code should *look* more like this:[code=php]function CheckName() {
    with ( window.document.forms[0] ) {
    if (cboforth.value.length == 0) {
    alert ("Please select a study name");
    return false;
    }
    }
    return true;
    }

    function someFunction(this) {
    if (window.document.form.cboforth) {
    window.open('sTudy_Detail.asp?strfildisplyename=<%=Server.URLEncode(strFith)%>', '_self');
    }
    else {
    CheckName();
    }
    }[/code]
  • ×

    Success!

    Help @skwak2 spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.16,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...