473,756 Members | 6,482 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ID names within a <div></div> pair?

Dear folks,

In Javascript, is it possible to get all id names within, say, a
<div></divpair? Like the array of "document.image s", I mean.

The reason I ask, is that I have a calender whose <td></tdtable
elements, within a given <div></div>, all have a class type, one of which
is "today" (to highlight it). Once the calender is drawn, the Javascript
has ended. And since Javascript has no known (to me) method of storing
variables in say, the system environment, on re-use I'll have to resort to
canceling the classes for all ids within the calender before I can
highlight a different day.

Make sense? :)

Thanks,

- Mark
Feb 27 '07 #1
13 2274
On Feb 27, 4:03 pm, "Mark" <a...@asarian-host.netwrote:
Dear folks,

In Javascript, is it possible to get all id names within, say, a
<div></divpair? Like the array of "document.image s", I mean.

The reason I ask, is that I have a calender whose <td></tdtable
elements, within a given <div></div>, all have a class type, one of which
is "today" (to highlight it). Once the calender is drawn, the Javascript
has ended. And since Javascript has no known (to me) method of storing
variables in say, the system environment, on re-use I'll have to resort to
canceling the classes for all ids within the calender before I can
highlight a different day.
You can make a persistent object that stores references to the cells
if you like. There are also various examples of
"getElementsByC lassName" functions in the archives. You can also give
elements multiple classes, then add and remove them as required.

One technique is to give the table cells an ID based on the date that
they represent (remember to always prefix numbers with a letter to
ensure valid IDs), then you change the IDs as you change the dates -
anything is possible. There are hundreds of calendar scripts out
there already, Matt Kruse has one here:

<URL: http://www.javascripttoolbox.com/lib/calendar/ >

although it needs to be modified to fix the date format to something
more appropriate for the web (it uses the USA's peculiar mm/dd/yyyy
format) - I don't think it would be too difficult.
--
Rob

Feb 27 '07 #2
"RobG" <rg***@iinet.ne t.auwrote in message
news:11******** **************@ z35g2000cwz.goo glegroups.com.. .

Thank you very much. That was an extremely helpful answer! :)

- Mark
Feb 27 '07 #3
In comp.lang.javas cript message <11************ **********@z35g 2000cwz.go
oglegroups.com> , Mon, 26 Feb 2007 22:50:44, RobG <rg***@iinet.ne t.au>
posted:
There are hundreds of calendar scripts out
there already, Matt Kruse has one here:

<URL: http://www.javascripttoolbox.com/lib/calendar/ >

although it needs to be modified to fix the date format to something
more appropriate for the web (it uses the USA's peculiar mm/dd/yyyy
format) - I don't think it would be too difficult.
It also starts the week with Sunday, even though the Almighty apparently
preferred Monday for that. But the "German" calendar just needs the
words to be translated from German to local preference. No mention of
the International Standard, of course. And I saw nothing on Week
Numbers.

while(this.getD ay()%6==0) // is shorter than
while(this.getD ay()==0 || this.getDay()== 6)

IIRC, this.setHours(0 , 0, 0, 0); worked in IE4.

In validating, there's no need to check for Leapness until it has been
established that it is a Feb 29 date. But for shorter code one can
compare the date with 28+Leap(Y) .

In <http://www.javascriptt oolbox.com/lib/date/examples.php>, the "Adding
Time" demo must have a problem. If I add 7500000 seconds and 0..7 years
to 2000-01-01 01:00:00, I should not always get the same time of day.
And its input windows are too narrow, though 75e5 will fit.

Adding Years Months Days Result
7 2 23 March 24, 2007 1:00:00 AM (Saturday)
7 2 24 March 25, 2007 12:00:00 AM (Sunday)
7 2 25 March 26, 2007 1:00:00 AM (Monday)

One hour different, on one of the days.

Adding 7 2 23 23 59 00 -March 25, 2007 12:59:00 AM (Sunday)
Adding 7 2 23 23 59 60 -March 25, 2007 12:00:00 AM (Sunday)

so adding 60 seconds more makes it an hour earlier. The page would be
better if that used ISO format, or user's choice.

N.B. North Americans will (mostly) be able to do corresponding tests but
with a different date and time. Remember ISO 16262:2002 15.9.1.8, last
paragraph of p.120. (ECMA : first para).
BTW, ISO 8601:2004 is published on the Web in PDF (plain & zip).

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v6.05 IE 6.
Web <URL:http://www.merlyn.demo n.co.uk/- w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demo n.co.uk/programs/- see 00index.htm
Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm etc.
Feb 28 '07 #4
Dr J R Stockton wrote:
><URL: http://www.javascripttoolbox.com/lib/calendar/ >
It also starts the week with Sunday, even though the Almighty
apparently preferred Monday for that.
That's configurable.
No mention of the International Standard, of course.
Date format is also easily configurable.
And I saw nothing on Week Numbers.
Never implemented because I never had the need for it.
In validating, there's no need to check for Leapness until it has been
established that it is a Feb 29 date. But for shorter code one can
compare the date with 28+Leap(Y) .
Code was written years ago and never optimized. Although premature
optimization is unnecessary, the code could certainly stand to be less
verbose in places. A full re-write is on my to do list, and has been for
almost 2 years.
In <http://www.javascriptt oolbox.com/lib/date/examples.php>, the
"Adding Time" demo must have a problem. If I add 7500000 seconds and
0..7 years to 2000-01-01 01:00:00, I should not always get the same
time of day.
Interesting. Have you looked at the code and found where the bug might be? I
have not yet verified myself that there is a bug, but if you have a patch it
would be great.
And its input windows are too narrow, though 75e5 will
fit.
I don't believe the maxlength prevents a larger value.
The page would be
better if that used ISO format, or user's choice.
I'm not sure by what standard "better" is judged.
Remember ISO 16262:2002
15.9.1.8, last paragraph of p.120. (ECMA : first para).
Hmm, I don't recall.
BTW, ISO 8601:2004 is published on the Web in PDF (plain & zip).
Well I'm sure that means somethin'

--
Matt Kruse
http://www.JavascriptToolbox.com
http://www.AjaxToolbox.com
Feb 28 '07 #5
Dr J R Stockton said the following on 2/27/2007 4:00 PM:
In comp.lang.javas cript message <11************ **********@z35g 2000cwz.go
oglegroups.com> , Mon, 26 Feb 2007 22:50:44, RobG <rg***@iinet.ne t.au>
posted:
> There are hundreds of calendar scripts out
there already, Matt Kruse has one here:

<URL: http://www.javascripttoolbox.com/lib/calendar/ >

although it needs to be modified to fix the date format to something
more appropriate for the web (it uses the USA's peculiar mm/dd/yyyy
format) - I don't think it would be too difficult.

It also starts the week with Sunday, even though the Almighty apparently
preferred Monday for that.
Don't let half the world know that.

<snip>

--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Feb 28 '07 #6
On Feb 28, 3:47 pm, Randy Webb <HikksNotAtH... @aol.comwrote:
Dr J R Stockton said the following on 2/27/2007 4:00 PM:
In comp.lang.javas cript message <1172559044.090 418.110...@z35g 2000cwz.go
oglegroups.com> , Mon, 26 Feb 2007 22:50:44, RobG <r...@iinet.net .au>
posted:
There are hundreds of calendar scripts out
there already, Matt Kruse has one here:
<URL:http://www.javascriptt oolbox.com/lib/calendar/>
although it needs to be modified to fix the date format to something
more appropriate for the web (it uses the USA's peculiar mm/dd/yyyy
format) - I don't think it would be too difficult.
It also starts the week with Sunday, even though the Almighty apparently
preferred Monday for that.

Don't let half the world know that.
Half? I think you've understated your case. ;-)

Christians make up only one third of the world's population, and some
of them (quite a few apparently) think the seventh day is Saturday.
Moslems, when using a Gregorian calendar, think its Friday.
--
Rob

Feb 28 '07 #7
RobG said the following on 2/28/2007 4:55 AM:
On Feb 28, 3:47 pm, Randy Webb <HikksNotAtH... @aol.comwrote:
>Dr J R Stockton said the following on 2/27/2007 4:00 PM:
>>In comp.lang.javas cript message <1172559044.090 418.110...@z35g 2000cwz.go
oglegroups.co m>, Mon, 26 Feb 2007 22:50:44, RobG <r...@iinet.net .au>
posted:
There are hundreds of calendar scripts out
there already, Matt Kruse has one here:
<URL:http://www.javascriptt oolbox.com/lib/calendar/>
although it needs to be modified to fix the date format to something
more appropriate for the web (it uses the USA's peculiar mm/dd/yyyy
format) - I don't think it would be too difficult.
It also starts the week with Sunday, even though the Almighty apparently
preferred Monday for that.
Don't let half the world know that.

Half? I think you've understated your case. ;-)
Probably so :)
Christians make up only one third of the world's population, and some
of them (quite a few apparently) think the seventh day is Saturday.
Moslems, when using a Gregorian calendar, think its Friday.
Judaism is also Friday.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Feb 28 '07 #8
In comp.lang.javas cript message <es*********@ne ws1.newsguy.com >, Tue, 27
Feb 2007 18:58:46, Matt Kruse <ne********@mat tkruse.composte d:
>Dr J R Stockton wrote:
>No mention of the International Standard, of course.

Date format is also easily configurable.
But there is no mention of the International Standard, which includes a
useful explanation of why your locally-preferred formats are
unreasonable.
>And I saw nothing on Week Numbers.

Never implemented because I never had the need for it.
Well, ISTM that to do it right one needs to be thinking more clearly
than, for example, MS.
>In <http://www.javascriptt oolbox.com/lib/date/examples.php>, the
"Adding Time" demo must have a problem. If I add 7500000 seconds and
0..7 years to 2000-01-01 01:00:00, I should not always get the same
time of day.

Interesting. Have you looked at the code and found where the bug might be? I
have not yet verified myself that there is a bug, but if you have a patch it
would be great.
No; it took me long enough to see where it rejected (correctly, of
course) Dec 32.
>And its input windows are too narrow, though 75e5 will
fit.

I don't believe the maxlength prevents a larger value.
The physical length prevents easy reading of a longer value, and there
is ample free space.
>The page would be
better if that used ISO format, or user's choice.

I'm not sure by what standard "better" is judged.
Well, about 95% of the world would prefer the time to use the 24-hour
clock; and it would be easier for everyone to check the date if that
also used numeric fields in descending order. Giving a choice is surely
better; one believes the USA to be in principle in favour of free
choice.
>Remember ISO 16262:2002
15.9.1.8, last paragraph of p.120. (ECMA : first para).

Hmm, I don't recall.
It is considerable importance to North Americans at the present time;
and particularly to those who publish such examples.
>BTW, ISO 8601:2004 is published on the Web in PDF (plain & zip).

Well I'm sure that means somethin'
You can find more, indirectly, by consulting the newsgroup FAQ.

I suggest that there should be an explicit and obvious statement of how
the code is intended to handle changes in offset from GMT.

There are basically three approaches :
(1) Consider every day to have 24 hours. For that, just use only the
UTC functions, which are quicker.
(2) Handle changes fully, which needs careful consideration of the exact
effects of the various non-UTC functions
(3) Neither of those.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v6.05 IE 6.
Web <URL:http://www.merlyn.demo n.co.uk/- w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demo n.co.uk/programs/- see 00index.htm
Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm etc.
Feb 28 '07 #9
In comp.lang.javas cript message <v6************ ********@telcov e.net>,
Wed, 28 Feb 2007 09:31:57, Randy Webb <Hi************ @aol.composted:
>RobG said the following on 2/28/2007 4:55 AM:
>On Feb 28, 3:47 pm, Randy Webb <HikksNotAtH... @aol.comwrote:
>>Dr J R Stockton said the following on 2/27/2007 4:00 PM:

In comp.lang.javas cript message <1172559044.090 418.110...@z35g 2000cwz.go
oglegroups.c om>, Mon, 26 Feb 2007 22:50:44, RobG <r...@iinet.net .au>
posted:
There are hundreds of calendar scripts out
there already, Matt Kruse has one here:
<URL:http ://www.javascriptt oolbox.com/lib/calendar/>
although it needs to be modified to fix the date format to something
more appropriate for the web (it uses the USA's peculiar mm/dd/yyyy
format) - I don't think it would be too difficult.
It also starts the week with Sunday, even though the Almighty apparently
preferred Monday for that.
Don't let half the world know that.
Half? I think you've understated your case. ;-)

Probably so :)
>Christians make up only one third of the world's population, and some
of them (quite a few apparently) think the seventh day is Saturday.
Moslems, when using a Gregorian calendar, think its Friday.

Judaism is also Friday.
Start/end of week and Holy Day (where applicable) are independent
concepts.

The Jewish Holy Day is not Friday, although it starts on Friday at
(sunset - 30 mins) or at 18:00 according to preference. They recognise
two types of week; starting or finishing on Saturday (which means Friday
evening to Saturday evening, in ISO 8601 terms).

Their Year 1 in fact started on a Monday, BC 3761-10-07 Julian.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v6.05 MIME.
Web <URL:http://www.merlyn.demo n.co.uk/- FAQish topics, acronyms, & links.
Proper <= 4-line sig. separator as above, a line exactly "-- " (SonOfRFC1036)
Do not Mail News to me. Before a reply, quote with ">" or "" (SonOfRFC1036)
Feb 28 '07 #10

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

Similar topics

13
3403
by: Mikko Ohtamaa | last post by:
From XML specification: The representation of an empty element is either a start-tag immediately followed by an end-tag, or an empty-element tag. (This means that <foo></foo> is equal to <foo/>) From XHTML specification:
8
14467
by: Daniel Hansen | last post by:
I know this must seem totally basic and stupid, but I cannot find any reference that describes how to control the spacing between <p>...</p> and <div>...</div> blocks. When I implement these on a page, there is a huge gap (like 3/8 inch or 25 px) between them. This is driving me bananas. What the hey am I missing? dh ------------------------------------------------ Dan Hansen ------------------------------------------------
8
5157
by: slim | last post by:
hi again all, i am still working on the website as mentioned in earlier threads and have hit another snag... http://awash.demon.co.uk/index.php http://awash.demon.co.uk/vd.css the php is pulling a name and placing it under the thumbnail (the text is
3
3812
by: Josef K. | last post by:
Asp.net generates the following html when producing RadioButton lists: <td><input id="RadioButtonList_3" type="radio" name="MyRadioButtonList" value="644" onclick="__doPostBack('SitesRadioButtonList_3','')" language="javascript" />
7
3631
by: pamelafluente | last post by:
The precious input given by Laurent, Martin, Benjamin about XMLHttpRequest in Javascript, has made me think that perhaps I could improve what I am currently doing by using Ajax. Let's make it simple and schematic, to see if there is a simple Ajax answer to this. A. I have an HTML page which has some pure html/css code representing a GRID of cell. The page may also contain other objects (images, etc). B. On the server I have a windows...
2
2967
by: Nikolai Onken | last post by:
Hey, I am trying to learn the exact behavior of CSS and was just placing a couple of <div>'s after each other. Each of the <divhas a <pwithin and some text within the <p> Now when I add a background-color to the div, the color won't fill up the entire space I believe it should. The div only has color around the text though it has one line space to the above element. I hope it is clear what I mean:
3
7854
by: rsteph | last post by:
I'm using two divs to create a shadowed-box type effect. Within the top div I want to put an image. I can get the image to center right to left, but not top to bottom. I'm making a series of boxes, and the images in them aren't all the same size. So I've sized the boxes to mach the largest of them, and I want to center them, so those that are smaller will be in the middle of the first div. Here's the code on the page: <table border="0"...
5
13538
by: Agix | last post by:
Hi there, Please check out : http://clarifysolutions.co.uk/certenroll/ The source is included below. This page is a test, so I can play about with paddings, margins and layouts using divs as semantically meaningless containers for bunch's of other elements - like everyone keeps telling me to make my code standards compliant. This request is not because I want a fix, but because I want to
8
10047
prino
by: prino | last post by:
Hi all, I've written code (in REXX) that takes files in legacy languages (PL/I, COBOL, z/OS assembler, etc) and converts them into HTML in a format similar to what's displayed in the z/OS ISPF editor. A fellow member of the PCG has helped me by creating a bit of Javascript to emulate the scrolling and using Google I've now gotten it into a state where it almost passes the W3C Markup Validation Service. However, the one error, Error Line 166,...
0
9462
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
9287
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
10046
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
9886
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
9857
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
9722
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
8723
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
7259
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
6542
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();...

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.