<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.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
|
|
0
|
|
|
|
Reply
|
jrs (45)
|
5/24/2007 9:46:22 PM |
|
On May 24, 2:46 pm, Dr J R Stockton <j...@merlyn.demon.co.uk> wrote:
> <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
|
|
0
|
|
|
|
Reply
|
ron
|
5/25/2007 12:55:06 AM
|
|
On May 24, 3:46 pm, Dr J R Stockton <j...@merlyn.demon.co.uk> wrote:
> 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 = "*"
}
}
|
|
0
|
|
|
|
Reply
|
scripts
|
5/25/2007 1:57:50 AM
|
|
In comp.lang.javascript message <1180054506.240417.286470@q19g2000prn.go
oglegroups.com>, Thu, 24 May 2007 17:55:06, ron.h.hall@gmail.com posted:
>On May 24, 2:46 pm, Dr J R Stockton <j...@merlyn.demon.co.uk> wrote:
>> <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.
|
|
0
|
|
|
|
Reply
|
Dr
|
6/6/2007 9:34:53 PM
|
|
On Jun 6, 2:34 pm, Dr J R Stockton <j...@merlyn.demon.co.uk> wrote:
> 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.uk> wrote:
> >> <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
|
|
0
|
|
|
|
Reply
|
ron
|
6/7/2007 1:48:36 PM
|
|
|
4 Replies
12287 Views
(page loaded in 0.087 seconds)
Similiar Articles: How to detect if daylight savings time are in effect? - comp.lang ...... to have it give the correct answer when daylight savings time are in effect? See my code below: $then = mktime ( 0 , 0, 0, 1,1,'00'); $now = time(); // Comment ... Does PAUSE have any Side Effect ?? - comp.lang.fortran... 0.5480553 .....z = -3.2033877 5) Remove or comment out the ... too had a similar problem and it has this similar curious effect. A statement not related to the code ... if statements to change indexing - comp.soft-sys.matlab> Can i use an if statement to effect indexing. i have code that works if i make an index with ... I don't really see what you're actually doing, so I can't comment on ... about undefined symbol in module C - comp.lang.asm.x86> void main(void) No comment. .... > extern void output ... My friend and I have checked the whole code and even ... it redirects ... clear the upper 32 bits as a side effect ... mencpy 128 bytes - comp.lang.asm.x86... MODERATOR'S COMMENT: Maybe the gentleman wants something ... no cpu involvement, but if this is time-critical code ... Figure 7: Cache-policy effect (cold cache, 128 bytes ... Proc Genmod Estimate Statement Question - comp.soft-sys.sas ...... we worked out the following bit of code to do log ... More coefficients than levels specified for effect ajcc2. Some coefficients will be ignored. When I comment out ... Simple code encryption (xor) problem - comp.lang.asm.x86 ...I'm learning to code in masm and I wanted to write ... The comment says "byte", and the logic calls for byte - I ... the <comma> ><backslash> <semicolon> has a useful effect ... Some text processing questions - comp.lang.vhdlFor instance, the following "would be" code doesn't ... functions as >is_whitespace_only(line) and is_comment(line). ... in string) is begin deallocate(L); --- has no effect ... Re: Proc Genmod Estimate Statement Question - comp.soft-sys.sas ...... parameter for the first (second) level of the an effect ... we worked out the following bit of > code to do log ... > > When I comment out the -1 in each of the estimate ... Custom assertion macros - comp.lang.c++.moderatedThe whole purpose of assertion is to fail immediately with as little effect on the code ... The macros replacement is to use inline function. Please comment which macros ... New Cuff Bracelets with Backless Bezel Ornaments - Jewelry Making ...On a cuff, flip that baby around and hang a little ... try using acrylics and see what kind of a cool effect ... SUNDAY, if you enter BSUE SHIP into the coupon code ... FDA Safety Tip: Tourniquet Cuffs on ADVANCE for NursesThe cuffs inflate with air, oxygen or nitrogen to ... smoothly, with no wrinkles or tunneling effect to ... Email, first name, comment and security code are required fields; all ... 7/19/2012 5:59:29 PM
|