473,395 Members | 1,377 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,395 software developers and data experts.

refer to text of url

How can I access the text of an url via javascript, ie. get 'foo' (and
send it as parameter in goto(), in example:

<a href="javascript:goto([foo])">foo</a>

Or refer to it globally?

document.links.href.text.value ?
this.href.text ?

--
Rgrds,
L.

Jul 20 '05 #1
6 6367
Can you clarify what you mean by accessing the text of a URL?

"Lars Vatland" <d2*******@yahoo.no> wrote in message
news:sh********************************@4ax.com...
How can I access the text of an url via javascript, ie. get 'foo' (and
send it as parameter in goto(), in example:

<a href="javascript:goto([foo])">foo</a>

Or refer to it globally?

document.links.href.text.value ?
this.href.text ?

--
Rgrds,
L.

Jul 20 '05 #2
I want to refer to the part between <a> and </a> in an url - the text
accompanying the url. Is it possible?
On Sat, 16 Aug 2003 18:03:44 +0100, "Andi B"
<an**@theblacktower.freeserve.co.uk> wrote:
Can you clarify what you mean by accessing the text of a URL?

"Lars Vatland" <d2*******@yahoo.no> wrote in message
news:sh********************************@4ax.com.. .
How can I access the text of an url via javascript, ie. get 'foo' (and
send it as parameter in goto(), in example:

<a href="javascript:goto([foo])">foo</a>

Or refer to it globally?

document.links.href.text.value ?
this.href.text ?

--
Rgrds,
L.


Jul 20 '05 #3
I dont honestly know - however, if you do as you have done in your example,
by putting the text you want to sent as a parameter already, it should
work - the only problem is that you do have to type the text each time.

"Lars Vatland" <d2*******@yahoo.no> wrote in message
news:01********************************@4ax.com...
I want to refer to the part between <a> and </a> in an url - the text
accompanying the url. Is it possible?
On Sat, 16 Aug 2003 18:03:44 +0100, "Andi B"
<an**@theblacktower.freeserve.co.uk> wrote:
Can you clarify what you mean by accessing the text of a URL?

"Lars Vatland" <d2*******@yahoo.no> wrote in message
news:sh********************************@4ax.com.. .
How can I access the text of an url via javascript, ie. get 'foo' (and
send it as parameter in goto(), in example:

<a href="javascript:goto([foo])">foo</a>

Or refer to it globally?

document.links.href.text.value ?
this.href.text ?

--
Rgrds,
L.

Jul 20 '05 #4
Hi,

Lars Vatland wrote:
How can I access the text of an url via javascript, ie. get 'foo' (and
send it as parameter in goto(), in example:

<a href="javascript:goto([foo])">foo</a>

Or refer to it globally?

document.links.href.text.value ?
this.href.text ?


The text of a link should, according to the Netscape doc, be accessible with

linkInstance.text;

However, there doesn't seem to be a way to identify a link namely. Of
course you can always use the links array, but working with indexes is
not good programming practice, except in loops of course.

alert( document.links[2].text );

It seems, however, to be the only way.

Note also that this fails in IE, which doesn't seem to recognize the
property "text" of the Link instance (alerts "undefined").

HTH,

Laurent
--
Laurent Bugnion, GalaSoft
Webdesign, Java, javascript: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch

Jul 20 '05 #5
Laurent Bugnion, GalaSoft wrote on 16 aug 2003 in comp.lang.javascript:
Note also that this fails in IE, which doesn't seem to recognize the
property "text" of the Link instance (alerts "undefined").


IE6:

<a href='' onclick="alert(this.innerText);return false">Text alert</a>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #6
Ok, thanks, I use

<a href='' onClick="q(this);return false">foo</a> bar<br>

(..and if else on this.text / this.innerText).

Is there a shorthand for 'return false', or avoid it?
--
/L.
Jul 20 '05 #7

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

Similar topics

0
by: hjyn | last post by:
Hi All, I have started with my php source code shown below, and how can I refer from one var to hidden var? ---------------------------------------------------------------------------- if...
0
by: hjyn | last post by:
Hi All, I have started my php source code shown below --------------------------------------------------------- if ((isset($_POST)) && ($_POST == "form1")) { $insertSQL = sprintf("INSERT...
2
by: Dean Slindee | last post by:
Is there any way to refer to the .text property of a status bar panel thru object syntax, like below (the inner "for" does not work): Public Function FormStatusBarPaint(ByVal frm As Form)...
3
by: JAPSTER | last post by:
An application has a startup form (Form1). A second form (frm2), created from within Form1. Each form has a textbox. To access the text in TextBox1 in frm2 from Form1, you use: ...
10
by: Bill Nguyen | last post by:
I have several textbox controls in a form,. I name them txt1, txt2, ... txt10. How dow I refer to them in a loop to get the value in text proerty of each control? For x = 1 to 10 value =...
11
by: giannis | last post by:
How can i refer to a form's textbox.text inside a SQL clause ? I know how is that in Access* but at VB i receive error. * SELECT FIELD1 FROM TABLE1 WHERE TABLE1.FIELD2=!.
6
by: Savante | last post by:
I have been writing a datalogging application. It reads in double's into a database. I want to be able to click on a row in a database (holds name of variable and also current value of variable)...
1
by: laredotornado | last post by:
Hi, I have this master frameset page <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML> <HEAD> <TITLE>Account Creation</TITLE> <META HTTP-EQUIV="Content-Type"...
2
cindy2
by: cindy2 | last post by:
Hi everybody, In my vb2005-project I have a subprocedure (in a MODULE) like this: Public Sub MakeInputArray() Input(0) = Form2.TextBox1.Text Input(1) = Form2.TextBox2.Text End Sub...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
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...

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.