aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Adding html tags to script Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Adding html tags to script " Watch "Adding html tags to script " New topic
Author

Adding html tags to script

K Robert
Ranch Hand

Joined: May 16, 2003
Posts: 116
I have the following code that creates the <title> on any given page.



Because we have to follow a new Acessibility and Usibility standards, we utilize software the reads text for the blind. In order to divide the page into sections, header level tags are used - H1, H2, H3 - for navigation.

I have tried several ways to get this into the document title with no success - not as text for display but as a snippet of html. So, if you viewed the source, it would read "<h1>TEST - ...</h1>. Any help will be greatly appreciated.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
What in the world is this actually doing? Why are you not using the normal title tags?

<title>Your title</title>

What do you get by setting the title with JavaScript. I am missing something here.

Eric
K Robert
Ranch Hand

Joined: May 16, 2003
Posts: 116
This is part of a utility function that sets the <title> for all the pages. Much of the reasoning behind this app design was based on use for handicapped and non-handicapped people. This involves a lengthy "Preference" page that allows the user to utilize the built in access modes. In any, this is an app that I inherited because I have to make it compliant with Accessibility Laws. Is it possible to do what I've asked?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61429
    
  67

I'm not really sure what you are asking...

You're trying to put HTML in the title tag? Odd. How would this aid in accessibility?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
K Robert
Ranch Hand

Joined: May 16, 2003
Posts: 116
The html would not be part of the title as it is displayed in the browser. Right now, as you can see, the <title> is generated with javascript. Based on the requirements sent to us by the Accessibility committee, the page needs to be divided with "heading" tags. I believe the software uses them for navigation.

Since this snippet of code is what generates the page title, can we add the <h1> there?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61429
    
  67

Sorry, still clear as mud. What does the <title> tag have to do with the <h1> and other header tags?
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
What they are saying is your page needs to be set up such as


That has nothing to do with a title. The title is plain text that does nothing for the user. If you put html in it, it will not do a thing other then look like <h1>sometext</h1> That would do nothing for a screen reader.

Think you need to do some investigation into: http://www.section508.gov/

Eric
K Robert
Ranch Hand

Joined: May 16, 2003
Posts: 116
If this can't be done, it can't be done. I was just asking. But, as to the reasoning behind this, the users and the A&U staff wanted to know if we could use the <title> as a source of information for the screen reader to utilize, so they can navigate between apps or screens.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61429
    
  67

Originally posted by K Robert:
If this can't be done, it can't be done.


We're still in the process of trying to figure out what "it" is.

But, as to the reasoning behind this, the users and the A&U staff wanted to know if we could use the <title> as a source of information


Why the title tag? And what kind of information? The title tag contains a simple string that is used to determine the caption to show on the browser window.
K Robert
Ranch Hand

Joined: May 16, 2003
Posts: 116
Okay - here goes the lengthy version and I am sorry for not posting this at first... Basically, this code snippet(app level *.js):



, grabs this(page level html)



to create the page title. So, basically, the page title and header are created from "id=PageTitle".

In order to facilitate a function in the screen reader, which creates a list box of all <h1>, <h2>, and <h3> tags for navigation; each area needs a heading tag.

Because the page title and heading are created from the "id=PageTitle", we can't wrap the "Blah Blah Blah" title in a heading tag because it will display in the page title as "<h1>Blah Blah Blah</h1>". So, we need away to tag the html w/out it displaying in the title.

As I look back at my previous posts, I think I was misrepresenting my question. Sorry!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Adding html tags to script