Click to See Complete Forum and Search --> : Javascript question on "onclick"


skwak2
03-09-2004, 02:38 PM
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);">

steelersfan88
03-09-2004, 02:55 PM
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: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();
}
}