Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old August 14th, 2008, 10:35 AM
eelco.v987
Guest
 
Posts: n/a
Default javascript in href or onclick?

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 :)
  #2  
Old August 14th, 2008, 05:55 PM
Jim Moe
Guest
 
Posts: n/a
Default 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)
  #3  
Old August 15th, 2008, 12:55 AM
Eric B. Bednarz
Guest
 
Posts: n/a
Default 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
  #4  
Old August 15th, 2008, 04:35 PM
Rick Merrill
Guest
 
Posts: n/a
Default 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?
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles