473,788 Members | 3,101 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Executing function when <link> navigation element is used

I'd like to execute a function when a <link rel="next" href="foo.htm">
type element is used. Although the "onclick" handler is allowed on the
element, presumably because the functionality of the element is made
available through a browser provided navbar the function doesn't execute
when using the element.

Anyone know if this is possible?

--
Spartanicus
Nov 16 '06 #1
6 1491
Spartanicus said the following on 11/16/2006 3:40 PM:
I'd like to execute a function when a <link rel="next" href="foo.htm">
type element is used. Although the "onclick" handler is allowed on the
element, presumably because the functionality of the element is made
available through a browser provided navbar the function doesn't execute
when using the element.

Anyone know if this is possible?
Never done anything with a navbar but you might try setting the
href="javascrip t:functionName( )"

--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 16 '06 #2
ASM
Spartanicus a écrit :
I'd like to execute a function when a <link rel="next" href="foo.htm">
type element is used. Although the "onclick" handler is allowed on the
element, presumably because the functionality of the element is made
available through a browser provided navbar the function doesn't execute
when using the element.

onload = function() {
var L = document.getEle mentsByTagName( 'link');
var ok = false;
for(var i=0; i<L.length; i++)
if(L[i].href && L[i].href.indexOf(' foo.htm')>0 &&
L[i].rel && L[i].rel=='next') ok=true;
if(ok) alert('right link');
}

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Nov 16 '06 #3
Randy Webb <Hi************ @aol.comwrote:
>I'd like to execute a function when a <link rel="next" href="foo.htm">
type element is used. Although the "onclick" handler is allowed on the
element, presumably because the functionality of the element is made
available through a browser provided navbar the function doesn't execute
when using the element.

Anyone know if this is possible?

Never done anything with a navbar but you might try setting the
href="javascri pt:functionName ()"
I need to preserve the href attribute value. I use JS to rewrite that
value, but I don't want to make the feature JS dependant.

--
Spartanicus
Nov 17 '06 #4
ASM <st************ *********@wanad oo.fr.invalidwr ote:
>I'd like to execute a function when a <link rel="next" href="foo.htm">
type element is used. Although the "onclick" handler is allowed on the
element, presumably because the functionality of the element is made
available through a browser provided navbar the function doesn't execute
when using the element.

onload = function() {
var L = document.getEle mentsByTagName( 'link');
var ok = false;
for(var i=0; i<L.length; i++)
if(L[i].href && L[i].href.indexOf(' foo.htm')>0 &&
L[i].rel && L[i].rel=='next') ok=true;
if(ok) alert('right link');
}
By "used" I meant "clicked", not present in the code.

--
Spartanicus
Nov 17 '06 #5
ASM
Spartanicus a écrit :
ASM <st************ *********@wanad oo.fr.invalidwr ote:
>>I'd like to execute a function when a <link rel="next" href="foo.htm">
type element is used. Although the "onclick" handler is allowed on the
element, presumably because the functionality of the element is made
available through a browser provided navbar the function doesn't execute
when using the element.
onload = function() {
var L = document.getEle mentsByTagName( 'link');
var ok = false;
for(var i=0; i<L.length; i++)
if(L[i].href && L[i].href.indexOf(' foo.htm')>0 &&
L[i].rel && L[i].rel=='next') ok=true;
if(ok) alert('right link');
}

By "used" I meant "clicked", not present in the code.
How do you expect to click something not present ?

<html>
<script type="text/javascript">
onload = function() {
var L = document.getEle mentsByTagName( 'A');
for(var i=0; i<L.length; i++)
if(L[i].href && L[i].href.indexOf(' foo.htm')>0 &&
L[i].rel && L[i].rel=='next')
L[i].onclick = function() {
alert('Gasp! I am discovered');
return false;}
}
</script>
<a href="#">test 1</a>
<a rel="next" href="foo.htm"> foo</a>
<a href="foo2.htm" >test 1</a>
</html>

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Nov 17 '06 #6
ASM <st************ *********@wanad oo.fr.invalidwr ote:
>By "used" I meant "clicked", not present in the code.

How do you expect to click something not present ?
That is the question I was asking. I'm not sure what phrase to use, not
"used", not "clicked", "activated" would probably have been better.

I am now experimenting with Randy's suggestion after I realised that I
could use <link rel="next" href="foo.htm"i n the HTML and then rewrite
the href value to "javascript:fun ctionName()" with JS.

--
Spartanicus
Nov 17 '06 #7

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

Similar topics

9
2961
by: Francesco Moi | last post by:
Hello. I'm trying to build a RSS feed for my website. It starts: ----------------//--------------------- <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd"> <rss version="0.91"> ----------------//----------------------
6
17168
by: Todd Peterson | last post by:
I'm encountering some wierd behavior with a <link> tag over an HTTPS connection, vs. an HTTP connection... In an ASP/HTML page on my website, I've add a <link rel="shortcut icon"...> in order to allow the users to add a shortcut (with icon) on their desktop, as well as seeing the icon in the URL. Our development server allows both HTTP and HTTPS connections, but the icon only appears to be available when requesting the page via HTTP???...
2
1650
by: Hernán Castelo | last post by:
hi i'm trying to do : <link rel="stylesheet" type="text/css" href="myurl..../inc/css/style.css"/> from the url field of the browser i can normally open the "style.css" with notepad but thru the <link> tag, IIS don't match the file ?? should i add some configuration to run CSS ? i'm using URLScan and have activated the .css extension
2
1814
by: brw | last post by:
Is there a way to dynamically add a link tag to the head block of an ..aspx page? I'm aware that you can add a link tag (or literal control) statically and then dynamically modify the attributes. I'm wondering if there's a way to add the tag from scratch at run time. thanks, Ben
2
1798
by: Alex Maghen | last post by:
I just learned about the wonderful ~ in paths in ASP.NET which allows me to reference the APPLICATION root instead of the IIS docroot. Love it! I'm finding that I can use ~ in many places as long as the control in which it's used is set to runat="server". It's very handy. Here's the problem. I have <link rel="STYLESHEET" type="text/css" href="/Shared/CSS/Global.css" / on every page of the site. I REALLY want to be able to locate the href of...
1
1445
by: Kanon | last post by:
Hi, I hope this is the proper newsgroup for this kind of question. I have just started to learn about RSS and made my first feed: http://www.herbaloutfitters.com/pbw/alpha/rss/1-1.xml Some newsreaders choked on it, however, so I ran it through feedvalidator.org. This is the message I got: line 15, column 68: XML parsing error: <unknown>:15:68: not well-formed (invalid token)
1
2382
by: Baldoni | last post by:
It's been years since putting together a page. This line in my HTML: <link type="text/css" rel="stylesheet" href="net4801style.css"> gives this problem (via weblint HTML checker): attribute 'TYPE' for <link> is extended markup (use -x <extension> to do this). Where might be found a resource, for simple folk, explaining how to best correct this?
17
1965
by: The Numerator | last post by:
I know a lot about HTML, but all this time I don't know what the <LINK> tags in the head do. There are those that call a stylesheet, favicon, etc. But what about those that state the contents of the page, identify the next and previous page, etc. Do some browsers support them or are they just for organization or something?
9
6906
by: Arancaytar | last post by:
I have so far seen two methods for including external resources as CSS stylesheets in a document. The first is this: <link href="/stylesheets/style.css" rel="stylesheet" type="text/css" /> And the second is this: <style type="text/css"> @import "/stylesheets/style.css"; </style>
0
10363
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10172
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
10110
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
8993
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 project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6749
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
5535
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4069
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
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.