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

? Storing Internal Information In An HTML Document (eg Inside Tags)

Hi,

I need a way of dividing up my site into "departments". What I want is
to be able to allow some JavaScript functions to perform differently based
on what department the current page is assigned to.

For example, if the user clicks on a link in a page, the link fires off
a JS function that checks what department the page is in and does something.
If the user clicks on that link on a different page assigned to a different
department, the function does something else.

What I tried to do was to put in an invisible DIV element in the pages
where the ID attribute of the DIV is "_dept_" and the NAME attribute is
whatever the department is. The JS function looks for the _dept_ element
and reads it's name attribute. The problem with this is that when I try to
validate the page I get an error on the name attribute (not in XHTML
Strict).
What can I do?
thanks.

--
Alec S.
alec <@> synetech <.> cjb <.> net
Jul 23 '05 #1
16 1520
> What I tried to do was to put in an invisible DIV element in the pages
where the ID attribute of the DIV is "_dept_" and the NAME attribute is
whatever the department is. The JS function looks for the _dept_ element
and reads it's name attribute. The problem with this is that when I try to
validate the page I get an error on the name attribute (not in XHTML
Strict).
What can I do?


Try using the id attribute instead of name.
Jul 23 '05 #2
Alec S. wrote:
What I tried to do was to put in an invisible DIV element in the pages
where the ID attribute of the DIV is "_dept_" and the NAME attribute is
whatever the department is. The JS function looks for the _dept_ element
and reads it's name attribute. The problem with this is that when I try to
validate the page I get an error on the name attribute (not in XHTML


Abuse another attribute -- say, title -- for this purpose. Or, even
better, stop trying to use such a broken technique.
Jul 23 '05 #3
"Leif K-Brooks" <eu*****@ecritters.biz> wrote in message
news:36*************@individual.net...
Or, even better, stop trying to use such a broken technique.


I would if you had suggested another way to do this. What exactly do
you mean by a "broken technique"?

--
Alec S.
alec <@> synetech <.> cjb <.> net
Jul 23 '05 #4
"Mr.Clean" <mrclean@p&g.com> wrote in message
news:1107288966.7d168ba6975cb17ed63b72fb7da6ebf7@t eranews...
Try using the id attribute instead of name.


I can't do that. I need a way of getting the element and reading it.
If I put the department name in ID, then I would have no way of finding the
tag in the first place.
--
Alec S.
alec <@> synetech <.> cjb <.> net
Jul 23 '05 #5
Please don't multi-post. See
<URL:http://www.cs.tut.fi/~jkorpela/usenet/xpost.html>.

Alec S. wrote:
"Leif K-Brooks" <eu*****@ecritters.biz> wrote in message
news:36*************@individual.net...
Or, even better, stop trying to use such a broken technique.
[...] What exactly do you mean by a "broken technique"?


As Leif pointed out, you're abusing an attribute[1] just to hack some
client-side script. Your original post also seems to attach importance
this script which, depending on your target audience, could be
considered broken, too.

Script data is script data. If you can't discern enough information
from the content itself, create an appropriate data structure and grab
the data from there. That said, I suspect you could examine the link,
if we continue that example, and determine where it goes - somewhere
in the current department or to another. That should provide enough
information on which you can base your decision.
--


Signature separators are composed of two dashes, followed by a space.
Newsreaders won't generally recognise a signature without the trailing
space.

Mike
[1] A non-existent one at that: DIV elements don't have name attributes.

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #6
Alec S. wrote:
Hi,

I need a way of dividing up my site into "departments". What I want is
to be able to allow some JavaScript functions to perform differently based
on what department the current page is assigned to.

For example, if the user clicks on a link in a page, the link fires off
a JS function that checks what department the page is in and does something.
If the user clicks on that link on a different page assigned to a different
department, the function does something else.

What I tried to do was to put in an invisible DIV element in the pages
where the ID attribute of the DIV is "_dept_" and the NAME attribute is
whatever the department is.
DIV doesn't *have* a NAME attribute.
The JS function looks for the _dept_ element
and reads it's name attribute. The problem with this is that when I try to
validate the page I get an error on the name attribute (not in XHTML
Strict).
What can I do?


You're already using Javascript, so why wouldn't you just use

<script type="text/javascript">
var dept = "blahblah"
</script>

?
Jul 23 '05 #7
"Michael Winter" <m.******@blueyonder.co.invalid> wrote in message
news:8r*****************@text.news.blueyonder.co.u k...
As Leif pointed out, you're abusing an attribute[1] just to hack some
client-side script. Your original post also seems to attach importance
this script which, depending on your target audience, could be
considered broken, too.

Script data is script data. If you can't discern enough information
from the content itself, create an appropriate data structure and grab
the data from there. That said, I suspect you could examine the link,
if we continue that example, and determine where it goes - somewhere
in the current department or to another. That should provide enough
information on which you can base your decision.
I am doing it this way to consolidate similar functions. Obviously I'm
not a pro and never claimed to be which is why I'm asking here.

Signature separators are composed of two dashes, followed by a space.
Newsreaders won't generally recognise [sic] a signature without the trailing space.


That's the way I've been doing it for the past 10 years but I'll look
into this.
--
Alec S.
alec <@> synetech <.> cjb <.> net
Jul 23 '05 #8
"Harlan Messinger" <hm*******************@comcast.net> wrote in message
news:36*************@individual.net...
You're already using Javascript, so why wouldn't you just use

<script type="text/javascript">
var dept = "blahblah"
</script>

Because then every page that uses the script would be assigned to the
same department. I want the script to perform slightly differently
depending on which department the page itself is reporting.

--
Alec S.
alec <@> synetech <.> cjb <.> net

Jul 23 '05 #9
"Alec S." <a@a.com> wrote:
"Harlan Messinger" <hm*******************@comcast.net> wrote in message
news:36*************@individual.net...
You're already using Javascript, so why wouldn't you just use

<script type="text/javascript">
var dept = "blahblah"
</script>


Because then every page that uses the script would be assigned to the
same department.


You could have different value on different pages. Writing a single
<div id="dept" name="foo"></div> into a page can't be much easier than
writing a single script element such as the one above.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 23 '05 #10
Alec S. wrote:
"Harlan Messinger" <hm*******************@comcast.net> wrote in message
news:36*************@individual.net...
You're already using Javascript, so why wouldn't you just use

<script type="text/javascript">
var dept = "blahblah"
</script>

Because then every page that uses the script would be assigned to the
same department.


Huh? Why? Are you incapable of replacing "blahblah" with the name of one
department on one page and the name of a different department on another
page?
Jul 23 '05 #11
"Alec S." <a@a.com> wrote in news:yo********************@rogers.com:
I need a way of dividing up my site into "departments".


Instead of suggesting the answer lies with the use of
javascript, try explaining what it is you want to do,
along with an example(even better if you provide a URL).
For example, my first though is "server-side scripting",
but it's not clear really what you want/need to do.

--
Dave Patton
Canadian Coordinator, Degree Confluence Project
http://www.confluence.org/
My website: http://members.shaw.ca/davepatton/
Jul 23 '05 #12
Nevermind, I got a suggestion from someone elsewhere. In case anyone
wants to know, it was to use a meta tag. Brilliant!
--
Alec S.
alec <@> synetech <.> cjb <.> net

Jul 23 '05 #13
Tim
"Michael Winter" <m.******@blueyonder.co.invalid> wrote
Signature separators are composed of two dashes, followed by a space.
Newsreaders won't generally recognise [sic] a signature without the
trailing space.

"Alec S." <a@a.com> posted:
That's the way I've been doing it for the past 10 years but I'll look
into this.


It's because you posted using Outlook Express, and it has a flaw in this
regard: It considers such trailing spaces to be extraneous, and removes
them, unless you patch the program with something else (such as the
"oequotefix" program, which also makes a number of improvements to how OE
quotes messages).

--
If you insist on e-mailing me, use the reply-to address (it's real but
temporary). But please reply to the group, like you're supposed to.

This message was sent without a virus, please delete some files yourself.
Jul 23 '05 #14
"Tim" <ti*@mail.localhost.invalid> wrote in message
news:15******************************@40tude.net.. .> It's because you posted
using Outlook Express, and it has a flaw in this
regard: It considers such trailing spaces to be extraneous, and removes
them, unless you patch the program with something else (such as the
"oequotefix" program, which also makes a number of improvements to how OE
quotes messages).


No, actually that's the way I've been doing it long before Outlook
Express existed. I use that in everything from forums to IM. It's just the
way I got used to doing it back in the BBS days. In fact OE insists on
putting a "-- " in to divide the signature regardless of what I have in it.
I'll take a look at oequitefix though. I hope it also fixes the way OE
messes with line breaks, I really hate that.
--
Alec S.
alec <@> synetech <.> cjb <.> net
Jul 23 '05 #15
Alec S. wrote:
In fact OE insists on putting a "-- " in to divide the signature
regardless of what I have in it.
No, actually it put in a "--" without the required space. <g>
I'll take a look at oequitefix though. I hope it also fixes the
way OE messes with line breaks, I really hate that.


OE-Quotefix is supposed to fix all that. Or ... get a modern newsreader!

--
-bts
-This space intentionally left blank.
Jul 23 '05 #16
Tim
"Tim" <ti*@mail.localhost.invalid> wrote in message
It's because you posted using Outlook Express, and it has a flaw in this
regard: It considers such trailing spaces to be extraneous, and removes
them, unless you patch the program with something else (such as the
"oequotefix" program, which also makes a number of improvements to how OE
quotes messages).

"Alec S." <a@a.com> posted:
No, actually that's the way I've been doing it long before Outlook
Express existed.
You misunderstood what I said... Regardless of what *you* typed into
Outlook Express (i.e. the correct, well recognised, "-- " sequence), it
modified it before sending the message to remove the trailing space.

For this sort of reason, some clients now recognise dash dash end-of-line
as the same thing. And to be honest, I can't see any true value in the
trailing space. A double dash on a line by itself is just as peculiar, and
unlikely to be deliberately typed for some other reason. And the immediate
end-of-line takes care of not mistaking it for anybody trying to simulate a
quote dash in front of a line of text.
In fact OE insists on putting a "-- " in to divide the signature
regardless of what I have in it.
Look closer, you'll discover it doesn't have the trailing space. Perhaps
it's there while originally editing the message, but it won't be
afterwards.
I'll take a look at oequitefix though. I hope it also fixes the way OE
messes with line breaks, I really hate that.


It makes a huge improvement in that area. Quite how OE can be so utterly
crap at quoting, considering how old it is, and the time that's been
available to fix it up, I don't know. But then MSIE is equally crap, and
Windows, and just about anything else made by Microsoft...

--
If you insist on e-mailing me, use the reply-to address (it's real but
temporary). But please reply to the group, like you're supposed to.

This message was sent without a virus, please delete some files yourself.
Jul 23 '05 #17

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

Similar topics

10
by: Rithish | last post by:
I want to emulate paging in an HTML document. something like, ------------------------- | | | <DIV> | | | | <TABLE></TABLE>...
2
by: Robert Hanson | last post by:
I am new to the asp.net application building and I have read the information regarding the storing of information using session vs cookies vs viewstate. I am asking for suggestions/guidance as to...
2
by: Filippo Bettinaglio | last post by:
Hi, I use, VS2005 C# I have a Windows Forms UserControl hosted within Internet Explorer According to MIcrosoft documentation: ...
4
by: csgraham74 | last post by:
Hi, Ive posted on this previously but had no response. Basically i need to build some html using a rich text editor. Then i want to actually create an html document from this and save it to my...
2
by: MorrganMail | last post by:
Hi, I am writing an SQL query in which I need to compare two fields which are both storing time information. The datatype of the first field is Date/Time and the format is HH:MM. The second...
9
by: Rob | last post by:
I'm writing an application without a user interface and I have a requirement to find the plain ASCII text between <Ptags in an HTML document which happens to have been obtained via POP3 and parsed...
3
by: SMH | last post by:
Normally an SVG document is loaded/parsed/interpreted inside an HTML document using an 'object' (or 'embed') element, although there are supposedly other ways too. The problem is, the SVG document...
4
by: anutosh100 | last post by:
I want to make an html document. Suppose the name of the html document is anu.html. What i want is at first it will show "hello anutosh", and after 5 sec there will be some other ...
11
Dormilich
by: Dormilich | last post by:
Lately I have seen so much awful HTML, that I like to show what a HTML document should look like, regarding the requirements from the W3C. the absolute minimum is defined as: or expressed in...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.