473,748 Members | 8,779 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Link to Function

I have seen partial answers to the following question but I am not sure
of the best approach. I have a page that will only work with
javascript. The link to the page indicates that.

Within the page I have a clickable link to a function. The best html
for that process seems to be:
<a href="xxx" onclick="TheFun ction(); return false">CLICK HERE</a>

I assume the "return false" causes the href to be ignored but the
function will be called. Since the page is only accessed with
javascript there is no need for a url. Is there some kind of dummy
entry that can be used in place of xxx or is that ok? It seems
unnecessary to create a page that will never be accesssed.

Is this the only way to link to a function from a link?

--
Dennis M. Marks
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 20 '05 #1
2 1755
Dennis M. Marks wrote:
I have seen partial answers to the following question but I am not sure
of the best approach. I have a page that will only work with
javascript. The link to the page indicates that.

Within the page I have a clickable link to a function. The best html
for that process seems to be:
<a href="xxx" onclick="TheFun ction(); return false">CLICK HERE</a>

I assume the "return false" causes the href to be ignored but the
function will be called.
Correct. The `return false' cancels the `click' event, so the
element is no longer considered interactive in this way after
the script engine has finished processing the expressions.
Since the page is only accessed with javascript
How can you be sure?
there is no need for a url.
Well, there is, otherwise it is not a hyperlink and you
should use another control. Why not input[type="button"]?
Is there some kind of dummy entry that can be used in place of
xxx
You could use `#' but you will append to the history of the user
that accidentally gets there without having client-side JavaScript
support (enabled).
or is that ok?
OK would be a hyperlink to a document that explains why the feature
requires client-side scripting if it is not supported.
It seems unnecessary to create a page that will never be accesssed.
Well, that depends.
Is this the only way to link to a function from a link?


It is not, but it is the best one. Read the FAQ.
PointedEars
Jul 20 '05 #2
"Dennis M. Marks" <de******@dcsi. net> writes:
Within the page I have a clickable link to a function. The best html
for that process seems to be:
<a href="xxx" onclick="TheFun ction(); return false">CLICK HERE</a>

I assume the "return false" causes the href to be ignored but the
function will be called. Since the page is only accessed with
javascript there is no need for a url. Is there some kind of dummy
entry that can be used in place of xxx or is that ok?
A link, as made with <a href="..."> is meant to link to another
page or resource. If you don't link to one, you shouldn't use
a link. If you just want something to push, use a button, that's
what they are made for:
<input type="button" value="CLICK HERE" onclick="TheFun ction()">

If you insist on using a link, the most harmless href you can use
is
href=""
The empty string is a valid URL fragment, and it should refer
to the page itself. Older browser might get confuzed, though.
It seems unnecessary to create a page that will never be accesssed.
The don't make a link.
Is this the only way to link to a function from a link?


If you insist on using a link, it is the best way. If anybody mentions
"javascript:The Function()" then ignore it. The "javascript :" URL scheme
should generally be avoided in web pages, as there are always better
ways to achieve what you need.
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #3

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

Similar topics

3
17092
by: Matt Adams | last post by:
As well known I could specify the text color in the body tag like: <BODY TEXT=WHITE LINK=WHITE VLINK=RED ALINK=WHITE> What I want to achieve now is that always (!) the text of the last visited link and the text of the link under the cursor are red. All other links should be white. The problem with the construction above is that a visited link remains for the rest of the session red regardless wether it was visited 17 clicks back in...
2
9174
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 in the status bar 'Symantec Corporation' whenever anyone mouses over (onMouseOver) my image or link OR when one clicks while holding the left mouse down (onClick) on the same image or link. Upon releasing the mouse (onMouseOut), the
4
1783
by: Newbie | last post by:
Is it possible to set up an event handler or something else so that when *any* link on the page is clicked it 'fires-up', executes some JS and then continues to process the link that was clicked? (Without having JS or 'onClick' added to each & every link?) I've looked everywhere but can't find out how, or if it's even possible via Javascript... Regards.
3
2258
by: JohnEGee | last post by:
Hello, all, and TIA for any help you can offer. I've searched the Internet for answers and have finally come here. I've created a page (several, actually) with a link that opens a pop-up window. It's a pop-up window in the sense that it's smaller than the man page and is intended to be viewed and then closed. The problem is that if I include a link on that pop-up window HTML page, when the link is clicked the new page opens IN the...
4
2735
by: kschneider | last post by:
Assume there's a form with it's action attribute all set to post to a URL, but without a submit control. Form submission is done via a link and I want to prevent the classic "double submit". Ignoring the server side of things, does anyone see any holes with the following script? It seems to work, but I'd appreciate other eyes on it. Maybe a try/catch/finally wrapper of some sort to be sure the link is re-enabled in the face of an...
11
11533
by: yangsuli | last post by:
i want to creat a link when somebody click the link the php script calls a function,then display itself :) i have tried <a href=<? funtion(); echo=$_server ?>text</a> but it will call the function whether i click the link then i tried this (using forms)
7
2953
by: ApexData | last post by:
Hello I currently Link the FE/BE using the LinkTables Option and the Linked Table Manager. Any time I need to move the BE to another location, I have to go through this process over again. I need the flexibility of being able to move the BE data to wherever I want, without manually going through this process. I just want to change the Path/Filename that I keep in a FE Table. I want to be able to place a Path/Filename in a FE Table...
7
13487
by: Kurda Yon | last post by:
Hi everybody, I cannot understand the following thinks. The last line of the fillowing code produces a message about mistake (not a valid MySQL- Link resource): $link = mysql_connect( "localhost","tmp_user","tmpxxx" ); mysql_select_db( $db_name, $link); $link = mysql_connect( "localhost","tmp_user","tmpxxx" ); mysql_close( $link );
11
13213
by: Kurda Yon | last post by:
Hi, I got this warning: mysql_query(): 4 is not a valid MySQL-Link resource. The line which cause this warning is: mysql_query("insert into $tablename (id,priority) values('$id', '0.00')", $link2); As far as understand the problem is that $link2 is "not a valid MySQL-
0
8989
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8828
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9367
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9319
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9243
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4599
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4869
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3309
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.