473,396 Members | 2,158 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 :)
Aug 14 '08 #1
3 3178
On 08/14/08 02:26 am, eelco.v987 wrote:
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?
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)
Aug 14 '08 #2
"eelco.v987" <ee********@gmail.comwrites:
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. :)
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.
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)"
>Chapter 1 support</a>
This ‘Validate’ function seems pretty versatile, by the way…
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
Aug 14 '08 #3
eelco.v987 wrote:
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?
Aug 15 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Julius Mong | last post by:
Dear all, according to the ASV3 manual known problem section, to make an <a> execute some Javascript onclick: ...
5
by: Mike | last post by:
In my previous post, I wrote: > ... > GOAL: (very simple) Provide a hyperlink which, when clicked, > calls a javascript function which opens a new URL. > ... > PROBLEM: The following code...
10
by: John Ortt | last post by:
Hi Everyone, I have created a Javascript menu for my site which uses frames. The first stage loads fine but I want two drill down menus ("About Me Menu" and "Projects Menu"). The pages load...
7
by: Marci | last post by:
I found this script for cascading menus, however, I cannot reach the author to solve the bug I am having when I add a second menu to it. My problem is this: If I click on the first link, the...
2
by: Kevin Lyons | last post by:
Hello, Can anyone assist me with what I am trying to do with the following code (six different scenarios to try to make the functionality work correctly)? I want to always (and ONLY) display...
14
by: tshad | last post by:
I posted this on the asp.net group, also. I wasn't sure whether this was an asp.net problem or a javascript problem. I have a page that was originally created from a program I found on the net...
9
by: Astra | last post by:
Hi everybody Wonder if you could help me out. I created a simple JavaScript routine to enable a user to click backwards and forwards between small news articles. This routine works fine in IE...
9
by: tshad | last post by:
This is from my previous post, but a different issue. I have the following Javascript routine that opens a popup page, but doesn't seem to work if called from an asp.net button. It seems to work...
8
by: chrisdude911 | last post by:
how do i add video into a javascript web page with my own custom buttons?
3
by: sonsofsound77 | last post by:
Hi all I'm new to JavaScript and working my way through the Teach yourself JS 1.5 book. All of the scripts in the book work perfectly apart from the listing 20.3 piano example....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.