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


Groups > comp.lang.javascript > #20297 > unrolled thread

Button doing work as a hot link ??

Started by"Mel Smith" <med_cutout_syntel@aol.com>
First post2013-06-14 20:36 -0600
Last post2013-07-10 13:39 +0200
Articles 13 — 5 participants

Back to article view | Back to comp.lang.javascript


Contents

  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

#20297 — Button doing work as a hot link ??

From"Mel Smith" <med_cutout_syntel@aol.com>
Date2013-06-14 20:36 -0600
SubjectButton doing work as a hot link ??
Message-ID<b222a4F6mg4U1@mid.individual.net>
Hi:

    I'll be placing a 'hot link' on my developing page.

    But, I wish it to be a *button* (rather than an anchor <a   >) whereby I 
can capture the 'click', then do my 'click-counting' and other work, then 
send the hot-link on its way to fruition.

    I googled around and found that the following code that looks promising, 
but I couldn't get it to work.

    In IE8 nothing happened after the click. With Chrome and FF the screen 
cleared but went to sleep.

    Is there something obvious I'm doing wrong ?

    btw, I've now forgotten where I found this code :(

    Below is a stripped-down version of what I'm trying (& failing) to do.

Thank you.

-Mel Smith


************************************
HTML:

<div id="ihoturl">
<form id="ihotlink" action="http://www.google.com">
<input type="button" onclick="gohotlink()" value="Visit the WebSite" />
</form>
</div>

JS:

function gohotlink() {
var linkobj = getobj("ihotlink") ;
linkobj.submit() ;
}

********************************** 

[toc] | [next] | [standalone]


#20298

FromDenis McMahon <denismfmcmahon@gmail.com>
Date2013-06-15 06:05 +0000
Message-ID<kph06m$su9$3@dont-email.me>
In reply to#20297
On Fri, 14 Jun 2013 20:36:50 -0600, Mel Smith wrote:

> <div id="ihoturl">
> <form id="ihotlink" action="http://www.google.com">
> <input type="button" onclick="gohotlink()" value="Visit the WebSite" />
> </form>
> </div>
> 
> JS:
> 
> function gohotlink() {
> var linkobj = getobj("ihotlink") ;
> linkobj.submit() ;
> }
> 
> **********************************

See http://www.sined.co.uk/tmp/urlbutton.htm for a couple of alternative 
approaches you could use.

-- 
Denis McMahon, denismfmcmahon@gmail.com

[toc] | [prev] | [next] | [standalone]


#20305

From"Mel Smith" <med_cutout_syntel@aol.com>
Date2013-06-15 08:53 -0600
Message-ID<b23dfjFfiijU1@mid.individual.net>
In reply to#20298
Denis said:

> See http://www.sined.co.uk/tmp/urlbutton.htm for a couple of alternative
> approaches you could use.

Thanks for the page Denis. I'll look at it today.

-Mel

[toc] | [prev] | [next] | [standalone]


#20309

From"Mel Smith" <med_cutout_syntel@aol.com>
Date2013-06-15 10:35 -0600
Message-ID<b23jf5Fgsp2U1@mid.individual.net>
In reply to#20298
Denis said:

> See http://www.sined.co.uk/tmp/urlbutton.htm for a couple of alternative
> approaches you could use.


Hi Denis:

    I looked and downloaded, and implemented :))

    That is exactly what I wanted ----   i.e.,   window.location = url

    I'll embellish on that for the next few days.  I think that when the 
link is clicked, I should be able to send back to my server (by/thru Ajax 
??) that the link to this club was clicked, and then do the database 
recording / analyzing at my server.  Hmmmm   ...

Thanks again   (and btw, my mobile home community in Arizona uses the 
results of your work (two years ago) every working day and I made them aware 
many months ago of your contribution.  I spend about 1/2 hour per day 
checking/updating the mesaeastpark.com site with new info -- your help to me 
and them is very much appreciated).

-Mel

[toc] | [prev] | [next] | [standalone]


#20299

From"Jukka K. Korpela" <jkorpela@cs.tut.fi>
Date2013-06-15 11:53 +0300
Message-ID<kph9pa$abr$1@dont-email.me>
In reply to#20297
2013-06-15 5:36, Mel Smith wrote:

>      I'll be placing a 'hot link' on my developing page.

This looks a bit like trolling.

>      But, I wish it to be a *button* (rather than an anchor <a   >) whereby I
> can capture the 'click', then do my 'click-counting' and other work, then
> send the hot-link on its way to fruition.

And you don't think you can have an onclick event in <a>? Or do you want 
to prevent Google & competitors from following the link, at any cost? 
You could use a <span> element with onclick, or you could use a <form> 
with <input type=button> or <button type=button>, but do you fear that 
Google might some was recognize the construct as a link and follow it?

>      btw, I've now forgotten where I found this code :(

This is compatible with the trolling hypothesis.

> var linkobj = getobj("ihotlink") ;

Where might getobj() be defined? What does the console say?

-- 
Yucca, http://www.cs.tut.fi/~jkorpela/

[toc] | [prev] | [next] | [standalone]


#20306

From"Mel Smith" <med_cutout_syntel@aol.com>
Date2013-06-15 09:10 -0600
Message-ID<b23efeFfpnvU1@mid.individual.net>
In reply to#20299
Jukka said:
> This looks a bit like trolling.

Why do you have to ascrive bad motives to me ??

> This is compatible with the trolling hypothesis.

Again !

    (This hot link will be to my future users' *own* web site. I would like 
*him* to know when and how many times his link on *my* site has been 
'clicked' by someone visiting my site.  Its also a learning experience for 
me too. )

>
>> var linkobj = getobj("ihotlink") ;
>
> Where might getobj() be defined? What does the console say?

    function getobj(cid) {
        return document.getElementById(cid) ;
    }


    another btw,  I run three other web sites from my own Apache server. 
They are all pro bono.  Whether the current one under development will be 
too, I'm not sure.

    Re: Trolling/Attacking   Over the last year or so, I've been DoS 
attacked many times on my other sites, and have consequently used 'Deny From 
www.xxx.yyy.zzz' for many of these attacking IPs.  My current developing 
site is only allowed access from myself --- at least for a few more months

    A troll I am not !


-Mel

 

[toc] | [prev] | [next] | [standalone]


#20308

From"Jukka K. Korpela" <jkorpela@cs.tut.fi>
Date2013-06-15 19:23 +0300
Message-ID<kpi44q$gkf$1@dont-email.me>
In reply to#20306
2013-06-15 18:10, Mel Smith wrote:

>      A troll I am not !

Thank you for confirming the trolling hypothesis so clearly.

-- 
Yucca, http://www.cs.tut.fi/~jkorpela/

[toc] | [prev] | [next] | [standalone]


#20310

From"Mel Smith" <med_cutout_syntel@aol.com>
Date2013-06-15 13:09 -0600
Message-ID<b23sfrFirnbU1@mid.individual.net>
In reply to#20308
Jukka said:
> Thank you for confirming the trolling hypothesis so clearly.
>

One common definition of trolling is:


      1. trolling Share on twitter Share on facebook Share on more 8662 up, 
5997 down
     Being a prick on the internet because you can. Typically unleashing one 
or more cynical or sarcastic remarks on an innocent by-stander, because it's 
the internet and, hey, you can.
      Guy: "I just found the coolest ninja pencil in existence."
      Other Guy: "I just found the most retarded thread in existence."


    So,  I don't believe I fall within the bounds of the above definition of 
'trolling'.  If *you* think I do, then maybe *you* have that problem instead 
of me.

-Mel


[toc] | [prev] | [next] | [standalone]


#20302

FromJJ <duh@nah.meh>
Date2013-06-15 17:49 +0700
Message-ID<1plstexpucyzv$.1xe3vuzhs2bmm.dlg@40tude.net>
In reply to#20297
On Fri, 14 Jun 2013 20:36:50 -0600, Mel Smith wrote:
>     But, I wish it to be a *button* (rather than an anchor <a   >) whereby I 
> can capture the 'click', then do my 'click-counting' and other work, then 
> send the hot-link on its way to fruition.

By "click-counting", if you meant do access a counter URL before navigating
to the link URL, the code needs to add a hidden IFRAME and when it's
finished loading, navigate to the link URL.

>     I googled around and found that the following code that looks promising, 
> but I couldn't get it to work.
[snip]
> JS:
> 
> function gohotlink() {
> var linkobj = getobj("ihotlink") ;
> linkobj.submit() ;
> }

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

[toc] | [prev] | [next] | [standalone]


#20307

From"Mel Smith" <med_cutout_syntel@aol.com>
Date2013-06-15 09:27 -0600
Message-ID<b23ff6Fg11pU1@mid.individual.net>
In reply to#20302
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() ;
}



[toc] | [prev] | [next] | [standalone]


#20593

From"ViLco" <villiber@tin.it>
Date2013-07-09 10:24 +0200
Message-ID<krgh0c$hcb$1@dont-email.me>
In reply to#20307
Mel Smith wrote:

> Because 1/2 of the time I work/develop in another C-based language (the 
> Harbour language --- xHarbour),
>        // lFoundit returns true (or in harbour --- .T.)
>
>        So, I use the function partof() below as a substitute

> function len(str) {

> function alltrim(str) {

> function empty(str) {

> function partof(c,str) {

> function left(cstr,numchars) {

> function right(cstr,numchars) {

> function upper(cstr) {

> function lower(cstr) {

From what I read here this xHarbour isn't C-based, it's Foxpro based
-- 
"Un pasto senza vino e' come un giorno senza sole"
Anthelme Brillat Savarin 

[toc] | [prev] | [next] | [standalone]


#20597

From"Mel Smith" <med_cutout_syntel@aol.com>
Date2013-07-09 09:50 -0600
Message-ID<b42pqkF81q5U1@mid.individual.net>
In reply to#20593
ViLco said:
> From what I read here this xHarbour isn't C-based, it's Foxpro based


[OT] follows:

Hi ViLco:

    No, harbour prgs are 'compiled' into C source code. Then, those .c files 
are compiled into .obj files, then the object files are linked (along with 
70+ librairies) into a .exe executable file.

    Of course, many years ago, the languages Foxbase / FoxPro / Clipper / 
dBase III / xBase, etc all served as a foundation for the modern Extended 
Harbour language starting back in 2001.  But now, along with this powerful 
language we are able thru Replaceable Data Drivers (RDDs) to accommodate 
almost any modern database system (including various SQL data drivers).

    btw, I use a harbour .exe as my CGI app for web sites. This app builds 
pages, accesses databases, inserts JS, etc, etc, then sends the page to my 
Apache Server for transmission to the client.  This app of course also 
quickly responds to AJAX calls,  building a string packet to pass back to 
the client

-Mel

[toc] | [prev] | [next] | [standalone]


#20602

From"ViLco" <villiber@tin.it>
Date2013-07-10 13:39 +0200
Message-ID<krjgps$ccf$1@dont-email.me>
In reply to#20597
Mel Smith wrote:

>> From what I read here this xHarbour isn't C-based, it's Foxpro based

> [OT] follows:
>
> Hi ViLco:
>
>    No, harbour prgs are 'compiled' into C source code. Then, those .c
> files are compiled into .obj files, then the object files are linked
> (along with 70+ librairies) into a .exe executable file.
>
>    Of course, many years ago, the languages Foxbase / FoxPro /
> Clipper / dBase III / xBase, etc all served as a foundation for the
> modern Extended Harbour language starting back in 2001.  But now,
> along with this powerful language we are able thru Replaceable Data
> Drivers (RDDs) to accommodate almost any modern database system
> (including various SQL data drivers).
>    btw, I use a harbour .exe as my CGI app for web sites. This app
> builds pages, accesses databases, inserts JS, etc, etc, then sends
> the page to my Apache Server for transmission to the client.  This
> app of course also quickly responds to AJAX calls,  building a string
> packet to pass back to the client

Thanks, it's interesting news
-- 
"Un pasto senza vino e' come un giorno senza sole"
Anthelme Brillat Savarin 

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web