JJ said:
> With that code alone, it'll never work in any web browser. getobj is not
> defined anywhere. Insert this function before the gohotlink function:
>
> function getobj(n) {
> return document.getElementById(n);
> }
>
> Or simply replace the gohotlink function with this one:
>
> function gohotlink() {
> var linkobj = document.getElementById("ihotlink");
> linkobj.submit();
> }
Hi JJ:
Of course, I defined getobj() exactly as you noted above, but failed to
include its definition in my example. I have used this for a few months
now. It prevents a lot of typing errors for me.
Because 1/2 of the time I work/develop in another C-based language (the
Harbour language --- xHarbour), I make many mistakes when moving from
Harbour to JavaScript several times a day. So, I created some utility
string functions (inter alia) for JS that emulate some those functions in
Harbour:
Here are a few below the starred line.
I must say tho that I miss the '$' operator in Javascript. In my
harbour language, it is implemented as follows:
lFoundit := "MEL" $ upper("isthatmelana##holeorwhat") //
looking for letters 'mel' in string
// lFoundit returns true (or in harbour --- .T.)
So, I use the function partof() below as a substitute
-Mel
*****************************
function setfocus(cid) {
document.getElementById(cid).focus();
}
function len(str) {
if (str && typeof str === "string") {
return str.length;
}
else return 0 ;
}
function alltrim(str) {
return str.replace(/^\s+|\s+$/g,"") ;
}
function empty(str) {
if (typeof str === "string" && str.length === 0) return true ;
if (typeof str === "number" && str.value === 0) return true ;
return false ;
}
function partof(c,str) {
return (str.indexOf(c) !== -1) ? true : false ;
}
function left(cstr,numchars) {
if (typeof cstr === "string" && typeof numchars === "number") return
cstr.substr(0,numchars) ;
return cstr ;
}
function right(cstr,numchars) {
if (typeof cstr === "string" && typeof numchars === "number") return
cstr.substring(cstr.length-numchars,cstr.length) ;
return cstr ;
}
function upper(cstr) {
return cstr.toUpperCase() ;
}
function lower(cstr) {
return cstr.toLowerCase() ;
}