OK you guys were so helpful with my last post I thought I'd give you my next problem. My code is as follows:
Defn_string is set out like this: description=URL
So defn_array[1] holds the URL, however for some descriptions there is no URL so defn_string is just: description
and defn_array[1] = 'undefined'
can I detect the absence <sp?> of a URL and act accordingly e.g:
Code:
function get_defn(term_string)
{
defn_string = eval(term_string.replace(/ /g,"_").toUpperCase());
defn_array = defn_string.split("=");
return defn_array[0]
};
function write_link()
{
linkspot.innerHTML = '<a href="' + defn_array[1] + '">More Information</a>'
}
Defn_string is set out like this: description=URL
So defn_array[1] holds the URL, however for some descriptions there is no URL so defn_string is just: description
and defn_array[1] = 'undefined'
can I detect the absence <sp?> of a URL and act accordingly e.g:
Code:
function write_link()
{
if(defn_array[1]!='undefined')
linkspot.innerHTML = '<a href="' + defn_array[1] + '">More Information</a>'
else
linkspot.innerHTML = 'No link available';
}
Iain X-)