<URL:http://www.merlyn.demon.co.uk/js-index.htm>, and js-dates.htm, and
some Easter pages, now include <BODY onload="Cuffs()">.
function Cuffs() { var ThisPage, ThisSite, J, DLJ, HREF
ThisPage = location.href.replace(/#.*/, "")
ThisSite = location.protocol + "//" + location.hostname + "/"
for (J in document.links) {
DLJ = document.links[J] ; HREF = DLJ.href
if (!HREF) continue // why an undefined ?
HREF = String(HREF)
if (HREF.indexOf(ThisPage) == 0) DLJ.title = "." ;
else if (HREF.indexOf(ThisSite) == 0) DLJ.title = "+" ;
else if (HREF.indexOf("http://") == 0) DLJ.title = "#" ;
else DLJ.title = "*" } }
Comment on the code or its effect?
Why does HREF = String(HREF) seem needed?
Only tested in XP sp2 IE6 & FF 2.0.0.3.
--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6
news:comp.lang.javascript FAQ <URL:http://www.jibbering.com/faq/index.html>.
<URL:http://www.merlyn.demon.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links. 4 1339
On May 24, 2:46 pm, Dr J R Stockton <j...@merlyn.demon.co.ukwrote:
<URL:http://www.merlyn.demon.co.uk/js-index.htm>, and js-dates.htm, and
some Easter pages, now include <BODY onload="Cuffs()">.
function Cuffs() { var ThisPage, ThisSite, J, DLJ, HREF
ThisPage = location.href.replace(/#.*/, "")
ThisSite = location.protocol + "//" + location.hostname + "/"
for (J in document.links) {
DLJ = document.links[J] ; HREF = DLJ.href
if (!HREF) continue // why an undefined ?
HREF = String(HREF)
if (HREF.indexOf(ThisPage) == 0) DLJ.title = "." ;
else if (HREF.indexOf(ThisSite) == 0) DLJ.title = "+" ;
else if (HREF.indexOf("http://") == 0) DLJ.title = "#" ;
else DLJ.title = "*" } }
Comment on the code or its effect?
Why does HREF = String(HREF) seem needed?
That would be due to the fact that your iteration construct causes all
properties of the document.links object to be included, many of which
you do not wish to access. Try
for ( J = 0; J < document.links.length; ++J ) {
...
}
--
../rh
On May 24, 3:46 pm, Dr J R Stockton <j...@merlyn.demon.co.ukwrote:
function Cuffs() { var ThisPage, ThisSite, J, DLJ, HREF
ThisPage = location.href.replace(/#.*/, "")
ThisSite = location.protocol + "//" + location.hostname + "/"
for (J in document.links) {
DLJ = document.links[J] HREF = DLJ.href
if (!HREF) continue // why an undefined ?
HREF = String(HREF)
if (HREF.indexOf(ThisPage) == 0) DLJ.title = "." ;
else if (HREF.indexOf(ThisSite) == 0) DLJ.title = "+" ;
else if (HREF.indexOf("http://") == 0) DLJ.title = "#" ;
else DLJ.title = "*" } }
Comment on the code or its effect?
Why does HREF = String(HREF) seem needed?
function Cuffs() {
var ThisPage,ThisSite,J,DLJ,HREF;
var l=location,links=document.links;
ThisPage = l.protocol+'//'+l.host+l.pathname+l.search
ThisSite = l.protocol+"//"+location.hostname+'/';
for(J=0;J<links.length;J++){
DLJ = links[J];
HREF = DLJ.href;
if (HREF.indexOf(ThisPage) == 0)
DLJ.title = ".";
else if (HREF.indexOf(ThisSite) == -1)
DLJ.title = "+";
else if (HREF.indexOf("http://") == -1)
DLJ.title = "#";
else DLJ.title = "*"
}
}
In comp.lang.javascript message <11**********************@q19g2000prn.go
oglegroups.com>, Thu, 24 May 2007 17:55:06, ro********@gmail.com posted:
>On May 24, 2:46 pm, Dr J R Stockton <j...@merlyn.demon.co.ukwrote:
><URL:http://www.merlyn.demon.co.uk/js-index.htm>, and js-dates.htm, and some Easter pages, now include <BODY onload="Cuffs()">.
>Why does HREF = String(HREF) seem needed? That would be due to the fact that your iteration construct causes all properties of the document.links object to be included, many of which you do not wish to access. Try
for ( J = 0; J < document.links.length; ++J ) {
I've been able to return to this code (which is now used in most of
those of my pages which use the corresponding Include file).
Understood; tested; OK; thanks.
--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME.
Web <URL:http://www.merlyn.demon.co.uk/- FAQqish topics, acronyms & links;
Astro stuff via astron-1.htm, gravity0.htm ; quotings.htm, pascal.htm, etc.
No Encoding. Quotes before replies. Snip well. Write clearly. Don't Mail News.
On Jun 6, 2:34 pm, Dr J R Stockton <j...@merlyn.demon.co.ukwrote:
In comp.lang.javascript message <1180054506.240417.286...@q19g2000prn.go
oglegroups.com>, Thu, 24 May 2007 17:55:06, ron.h.h...@gmail.com posted:
On May 24, 2:46 pm, Dr J R Stockton <j...@merlyn.demon.co.ukwrote:
<URL:http://www.merlyn.demon.co.uk/js-index.htm>, and js-dates.htm, and
some Easter pages, now include <BODY onload="Cuffs()">.
Why does HREF = String(HREF) seem needed?
That would be due to the fact that your iteration construct causes all
properties of the document.links object to be included, many of which
you do not wish to access. Try
for ( J = 0; J < document.links.length; ++J ) {
I've been able to return to this code (which is now used in most of
those of my pages which use the corresponding Include file).
Understood; tested; OK; thanks.
All's swell that mends well. You're welcome!
--
../rh This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Hung Jung Lu |
last post by:
Hi,
I know people have talked about it before, but I am still really
confused from reading the old messages.
When I talk about code blocks, I am not talking about Lisp/Ruby/Perl,
so I am not...
|
by: AnnMarie |
last post by:
<script language="JavaScript" type="text/javascript">
<!--
function validate(theForm)
{
var validity = true; // assume valid
if(frmComments.name.value=='' && validity == true)
{
alert('Your...
|
by: Matt Kruse |
last post by:
I am far from a PHP expert, and I've been struggling to create a function
which will take a javascript .js file and "compact" it as much as possible.
Meaning, remove all comments and unnecessary...
|
by: Martin Jørgensen |
last post by:
Hi,
I don't understand these errors I get:
g++ Persort.cpp
Persort.cpp: In function 'int main()':
Persort.cpp:43: error: name lookup of 'j' changed for new ISO 'for' scoping
Persort.cpp:37:...
|
by: Marcus |
last post by:
I have a function that simply returns TRUE if it can connect to a
particular Sql Server 2005 express, or FALSE if it cannot. I am getting
some strange error codes returned when the computer that...
| |
by: Rex |
last post by:
Hi All - I have a question that I think MIGHT be of interest to a
number of us developers. I am somewhat new to VIsual Studio 2005 but
not new to VB. I am looking for ideas about quick and...
|
by: scriptguru |
last post by:
I've found some funny pieces of code in one project... I don't know: to
laught or to cry =)
function toHex(decimal) {
switch(decimal) {
case 10:
return "A";
case 11:
return "B";
case 12:
|
by: vlsidesign |
last post by:
I am a newbie and going through "The C programming language" by
Kernighan & Richie on my own time (I'm not a programmer but I want to
learn because it can save me time in my normal job, and it is...
|
by: daskumardilip |
last post by:
how to remove comment from c source code.
|
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,...
|
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,...
| |
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: 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,...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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 ...
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |