Connecting Tech Pros Worldwide Forums | Help | Site Map

javascript in href or onclick?

eelco.v987
Guest
 
Posts: n/a
#1: Aug 14 '08
Hello,
I am buildig a website, which uses javascript for several features
such as fieldvalidation, popupwindows etc.

Currently I am using <a href="#foo"
onClick="Validate('form_comment_fieldname')">Valid ate</amainly
becuase I do not want to openly show the variables in the browser.
In the case of a popup I have this:
<a href="#foo" onClick="Validate('http://www.mysite.com/helpdocs/
donotopen/chapter1/index15.html)">Chapter 1 support</a>
But the thing is, I don't like the #foo as url either.

So I was wondering what's the most common way to call javascript
functions from html as onclick or straight in the href?

thanks for reading and please share your thoughts :)

Jim Moe
Guest
 
Posts: n/a
#2: Aug 14 '08

re: javascript in href or onclick?


On 08/14/08 02:26 am, eelco.v987 wrote:
Quote:
Hello,
I am buildig a website, which uses javascript for several features
such as fieldvalidation, popupwindows etc.
>
And if javascript is disabled? And if popup windows are disabled?
I'm sure you do not depend on client-side data verification, correct?
Quote:
So I was wondering what's the most common way to call javascript
functions from html as onclick or straight in the href?
>
And if javascript is disabled?
It is quite annoying to visit a site and have the links completely dead
or have no navigation appear at all because it depends on javascript.
Using the pseudo-protocol "javascript:" in href is a bad choice.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Eric B. Bednarz
Guest
 
Posts: n/a
#3: Aug 15 '08

re: javascript in href or onclick?


"eelco.v987" <eelco.v987@gmail.comwrites:
Quote:
Currently I am using <a href="#foo"
onClick="Validate('form_comment_fieldname')">Valid ate</amainly
becuase I do not want to openly show the variables in the browser.
Come again?
(That’s a rethorical question; but some people around here have
repeatedly announced to happily engage in a wild-goose chase for
undisclosed problems, so stay tuned. :)
Quote:
In the case of a popup I have this:
<a href="#foo" onClick="Validate('http://www.mysite.com/helpdocs/
donotopen/chapter1/index15.html)">Chapter 1 support</a>
^
It doesn’t help much that you are providing defunct code snippets.
Quote:
But the thing is, I don't like the #foo as url either.
<a
href="http://www.mysite.com/helpdocs/donotopen/chapter1/index15.html"
onclick="Validate(this.href)"
Quote:
>Chapter 1 support</a>
This ‘Validate’ function seems pretty versatile, by the way…
Quote:
So I was wondering what's the most common way to call javascript
functions from html as onclick or straight in the href?
There’s nothing straight about the javascript pseudo protocol. It’s bad
for accessibility, very buggy in Internet Explorer and totally
unnecessary (so for “most common” in the sense of pure quantity you have
a winner here :).

--
||| hexadecimal EBB
o-o decimal 3771
--oOo--( )--oOo-- octal 7273
205 goodbye binary 111010111011
Rick Merrill
Guest
 
Posts: n/a
#4: Aug 15 '08

re: javascript in href or onclick?


eelco.v987 wrote:
Quote:
Hello,
I am buildig a website, which uses javascript for several features
such as fieldvalidation, popupwindows etc.
>
Currently I am using <a href="#foo"
onClick="Validate('form_comment_fieldname')">Valid ate</amainly
becuase I do not want to openly show the variables in the browser.
In the case of a popup I have this:
<a href="#foo" onClick="Validate('http://www.mysite.com/helpdocs/
donotopen/chapter1/index15.html)">Chapter 1 support</a>
But the thing is, I don't like the #foo as url either.
>
So I was wondering what's the most common way to call javascript
functions from html as onclick or straight in the href?
>
thanks for reading and please share your thoughts :)
Doesn't javascript have its own 'onclick' tool?
Closed Thread