give_it_a_lash
08-26-2010, 04:30 PM
Function findsometing()
(
var myString = 'results' + '<BR>'
for (var initiator, test condition,incrementor.)
{
if (.....)
{
myString ='some quote';
}
else if (.....)
{
myString += something + '<br>'
}
else if (....... )
{
myString += something + '<br>'
}
else
{
myString += '';
}
}
displayMessage(myString)
)
I am a complete newbie to javascript and programming, so excuse any faux pas, but I want to check the myString variable after all the loops in the for loop statement have been completed. For example if nothing was added to the var myString after the completeion of the for loop, i want to display a message that no results found. i tried various attempts of an if statement along lines of
}
}
if (myString = 'results') ....i also tried if myString= ('results' + '<BR>')
{
displayMessage('no results found')
}
else
{
displayMessage(myString)
}
)
Any pointers as to where i am going wrong?
(
var myString = 'results' + '<BR>'
for (var initiator, test condition,incrementor.)
{
if (.....)
{
myString ='some quote';
}
else if (.....)
{
myString += something + '<br>'
}
else if (....... )
{
myString += something + '<br>'
}
else
{
myString += '';
}
}
displayMessage(myString)
)
I am a complete newbie to javascript and programming, so excuse any faux pas, but I want to check the myString variable after all the loops in the for loop statement have been completed. For example if nothing was added to the var myString after the completeion of the for loop, i want to display a message that no results found. i tried various attempts of an if statement along lines of
}
}
if (myString = 'results') ....i also tried if myString= ('results' + '<BR>')
{
displayMessage('no results found')
}
else
{
displayMessage(myString)
}
)
Any pointers as to where i am going wrong?