CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> Java

 Empty Variable

Print topic Send  topic

Author Message
Ron


Posts: 26
Posted: 09/17/2004, 12:03 PM

I'm using the following getParam function to retrieve a URL parameter:

function getParam(string,parm) {
var startPos = string.indexOf(parm + "=");
if (startPos > -1) {
startPos = startPos + parm.length + 1;
var endPos = string.indexOf("&",startPos);
if (endPos == -1)
endPos = string.length;
return unescape(string.substring(startPos,endPos));
}
return '';
}

I'm using the getParam function to set a variable in another function as follows:

function MenuShow(secid)
{
var intTeam = getParam(document.URL,"TeamID");
curr = secid;

if (intTeam > 0)
{
if (secid == 1) {document.images['tab_Home'].src = 'images/tab_Home-On.gif'};
if (secid == 2) {document.images['tab_TeamSched'].src = 'images/tab_TeamSched-On.gif'};
if (secid == 3) {document.images['tab_TeamRoster'].src = 'images/tab_TeamRoster-On.gif'};
if (secid == 4) {document.images['tab_TeamOrg'].src = 'images/tab_TeamOrg-On.gif'};
if (secid == 5) {document.images['tab_TeamPhoto'].src = 'images/tab_TeamPhoto-On.gif'};
}
else
{
if (secid == 1) {document.images['tab_Home'].src = 'images/tab_Home-On.gif'};
if (secid == 2) {document.images['tab_About'].src = 'images/tab_About-On.gif'};
if (secid == 3) {document.images['tab_Register'].src = 'images/tab_Register-On.gif'};
if (secid == 4) {document.images['tab_Team'].src = 'images/tab_Team-On.gif'};
if (secid == 5) {document.images['tab_Link'].src = 'images/tab_Link-On.gif'};
}
}
</script>

My problem is when there is no TeamID in the URL I get an Object Expected error on the following line:

var intTeam = getParam(document.URL,"TeamID");

How can I convert getParam(document.URL,"TeamID") to 0 if it returns a empty set?
View profile  Send private message
biaapc
Posted: 10/05/2004, 2:31 PM

Instead of:

return '';

use

return 0;

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.