Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #20307

Re: Button doing work as a hot link ??

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From "Mel Smith" <med_cutout_syntel@aol.com>
Newsgroups comp.lang.javascript
Subject Re: Button doing work as a hot link ??
Date Sat, 15 Jun 2013 09:27:31 -0600
Lines 93
Message-ID <b23ff6Fg11pU1@mid.individual.net> (permalink)
References <b222a4F6mg4U1@mid.individual.net> <1plstexpucyzv$.1xe3vuzhs2bmm.dlg@40tude.net>
X-Trace individual.net IVerBK8sbkFH0xlzugIv8Q+oTLBU8wF/aMM90/maFHBFOyJT1m
Cancel-Lock sha1:w4edFDqqyJgKcgnpG7wT/D3WZQs=
X-Priority 3
X-MSMail-Priority Normal
X-Newsreader Microsoft Outlook Express 6.00.2900.5931
X-MimeOLE Produced By Microsoft MimeOLE V6.00.2900.6157
X-RFC2646 Format=Flowed; Original
Xref csiph.com comp.lang.javascript:20307

Show key headers only | View raw


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() ;
}



Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Button doing work as a hot link  ?? "Mel Smith" <med_cutout_syntel@aol.com> - 2013-06-14 20:36 -0600
  Re: Button doing work as a hot link  ?? Denis McMahon <denismfmcmahon@gmail.com> - 2013-06-15 06:05 +0000
    Re: Button doing work as a hot link  ?? "Mel Smith" <med_cutout_syntel@aol.com> - 2013-06-15 08:53 -0600
    Re: Button doing work as a hot link  ?? "Mel Smith" <med_cutout_syntel@aol.com> - 2013-06-15 10:35 -0600
  Re: Button doing work as a hot link  ?? "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2013-06-15 11:53 +0300
    Re: Button doing work as a hot link  ?? "Mel Smith" <med_cutout_syntel@aol.com> - 2013-06-15 09:10 -0600
      Re: Button doing work as a hot link  ?? "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2013-06-15 19:23 +0300
        Re: Button doing work as a hot link  ?? "Mel Smith" <med_cutout_syntel@aol.com> - 2013-06-15 13:09 -0600
  Re: Button doing work as a hot link  ?? JJ <duh@nah.meh> - 2013-06-15 17:49 +0700
    Re: Button doing work as a hot link  ?? "Mel Smith" <med_cutout_syntel@aol.com> - 2013-06-15 09:27 -0600
      Re: Button doing work as a hot link  ?? "ViLco" <villiber@tin.it> - 2013-07-09 10:24 +0200
        Re: Button doing work as a hot link  ?? "Mel Smith" <med_cutout_syntel@aol.com> - 2013-07-09 09:50 -0600
          Re: Button doing work as a hot link  ?? "ViLco" <villiber@tin.it> - 2013-07-10 13:39 +0200

csiph-web