f



Javascript and IE? Javascript and C#?

While my question might be simple, the environment around it is
terribly messy and so I will try to keep this clear and simple by only
including the relevant code - however, as I will soon suggest, I worry
that the problem isnt in what would seem to be the relevant code but
instead is lost somewhere in the do-and-donts of the peripheral code.
So at the end, i'll try to include all the affected code and you can
see if any of its actually relevant.  I know there is a lot going on...
sorry, but I tried to write this clearly.

So here is what I imagine to be relevant. I'm working with a page that
uses a very simple javascript function change the style of an <li>
element (display=block;).  The code is simple...which is why I cant
understand my problem.  This function is being called by <body
onload="fop()">

// Javascript function

function fop()
{
	var dropDown = document.getElementById("region");
	var firstName = dropDown.name;
	var fload = document.getElementById(firstName);
	fload.style.display = "block";
}

//  This is where it grabs the name value.  "View Source" confrims the
values work, (eg. name="ZHT")
<select name="<%=Request.QueryString("lang")%>" id="region"
onchange="selectMenu();">


//This is one of the <li> tags
<li class="operatorLI" id="ZHT">


// Later for testing, I tried this (see below)
<li class="operatorLI" id="ZHT" name="TESTME">

The result is this.  Firefox works, IE doesn't haha.

In more detail, when I use alert() to "trace" (sorry, im actually a
flash developer and damnit, I need my trace() function!) the progress
of the function, the function doesnt break...but I can see where
things, for whatever crack-head reason, start to go strange.  They go
strange when I ask for the name value of "fload", Firefox correctly
returns the name value of the <li> which would be "TESTME" while I
returns the name value for the <select> tag which is "ZHT".

....?!?!  what?!!?

Obviously, I played with this alot...and I cant seem to find the
reason for it.  I tried taking out all the dynamic stuff and hard
coding things - still, what the hell, it ALWAYS gives me the name
value for the <select> tag as if it were completely ignoring
getElementsById();

So im guessing this has something to do with the way that im rendering
things in C#.  I know that IE is a little girl who, if things arent
spelled out exactly right, crys and breaks.  So did I mess something
up?  Is my onload() broken?  Seriously...im at a loss here.

So, any ideas guys?

Well if that didn't help, here is the all the code (I added some
comments so you could walk along with it).  There are three pages plus
a javascript at the end.  Sorry, but I can't include the assembly
because there is some sensitive stuff - but trust that it works and
more, it really does have nothing to do with this.  You can see how
its used by the literals, it really has nothing to do with this.

PAGE 1 - ss.aspx:

<%@ Import Namespace="genieLibrary" %>
<%@ Assembly Src="includes/genieClasses.cs" %>
<script language="C#" runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
//Starts new webservice
genieWebService gweb = new genieWebService();

//Nav bar
productNav.Text = gweb.getNav();

// Gets URL variables
string url = Request.QueryString["page"];

//Location of the files
string page = "includes/serviceSupport/";

// Setup new controller for dynamic page content
Control loadThis ;

	// These are the different file names
	switch (url) {
		case "dealerTools":
		loadThis = LoadControl(page + "dealerTools.ascx");
		break;
		case "tech":
		loadThis = LoadControl(page + "techSupport.ascx");
		break;
		case "training":
		loadThis = LoadControl(page + "training.ascx");
		break;
		default:
		loadThis = LoadControl(page + "default.ascx");
		break;
	}

	if(url == "manuals")
	{
		string kind = Request.QueryString["c"];

		// Need to bring the value of page back to "zero" so to speak
		page = "includes/serviceSupport/";

		// These are the different file names
			switch (kind)
				{
					case "parts":
					loadThis = LoadControl(page + "manuals_parts.ascx");
					break;
					case "service":
					loadThis = LoadControl(page + "manuals_service.ascx");
					break;
					case "operator":
					loadThis = LoadControl(page + "manuals_operator.ascx");
					bodyAtts.Text = " onload=\"fop()\"";
					break;
					case "lang":
					loadThis = LoadControl(page + "manuals_lang.ascx");
					break;
					case "specs":
					loadThis = LoadControl(page + "manuals_specs.ascx");
					break;
					case "schematics":
					loadThis = LoadControl(page + "manuals_schematics.ascx");
					break;
					default :
					loadThis = LoadControl(page + "manuals_main.ascx");
					break;
				}
	}

//  Sends data to the placeholder named "mainContnet" and adds
//  Content of the controler "loadThis"
mainContent.Controls.Add(loadThis);

//  End of sub routine
}

</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<title>Genie Industries - Product Manuals</title>
<link type="text/css" href="jscss/serviceSupport.css"
rel="stylesheet" />
<!-- #include file="includes/header.aspx" -->
<script language="javascript" src="jscss/manualMenu.js"></script>
</head>
<body<asp:Literal id="bodyAtts" runat="server" />>


Page 2 - manuals_lang.ascx

<div id="ss">
<h3>SOME PAGE TITLE</h3>
<p>Select your language
<ul class="manuals" style="display:block; margin: 0 0 0 2em;">
<li><a href="ss.aspx?page=manuals&c=operator&lang=ZHT">Chinese
Simplified</a></li>
<li><a href="ss.aspx?page=manuals&c=operator&lang=CT">Chinese
Traditional</a></li>
<li><a href="ss.aspx?page=manuals&c=operator&lang=Ch">Czech</a></li>
<li><a href="ss.aspx?page=manuals&c=operator&lang=DA">Danish</a></li>
<li><a href="ss.aspx?page=manuals&c=operator&lang=DU">Dutch</a></li>
<li><a href="ss.aspx?page=manuals&c=operator&lang=EN">English</a></li>
<li><a href="ss.aspx?page=manuals&c=operator&lang=FI">Finnish</a></li>
<li><a href="ss.aspx?page=manuals&c=operator&lang=FR">French</a></li>
<li><a href="ss.aspx?page=manuals&c=operator&lang=DE">German</a></li>
<li><a href="ss.aspx?page=manuals&c=operator&lang=HU">Hungarian</a></
li>
<li><a href="ss.aspx?page=manuals&c=operator&lang=IT">Italian</a></li>
<li><a href="ss.aspx?page=manuals&c=operator&lang=JP">Japanese</a></
li>
<li><a href="ss.aspx?page=manuals&c=operator&lang=KO">Korean</a></li>
<li><a href="ss.aspx?page=manuals&c=operator&lang=NO">Norwegian</a></
li>
<li><a href="ss.aspx?page=manuals&c=operator&lang=PO">Polish</a></li>
<li><a href="ss.aspx?page=manuals&c=operator&lang=PT">Portuguese
Brazilian</a></li>
<li><a href="ss.aspx?page=manuals&c=operator&lang=RO">Romanian</a></
li>
<li><a href="ss.aspx?page=manuals&c=operator&lang=RU">Russian</a></li>
<li><a href="ss.aspx?page=manuals&c=operator&lang=ES">Spanish</a></li>
<li><a href="ss.aspx?page=manuals&c=operator&lang=SW">Swedish</a></li>
</ul>
</div>

Page 3 - manuals_operator.ascx

<div id="ss">
<div id="changeLang">
<p>Change selected language<br />
//Select tag that makes different elements visible/invisible with the
onchange()
<select name="<%=Request.QueryString("lang")%>" id="region"
onchange="selectMenu();">
<option value=""> - Select - </option>
<option value="CS">Chinese Simplified</option>
<option value="CT">Chinese Traditional</option>
<option value="CZECH">Czech</option>
<option value="DANISH">Danish</option>
<option value="DUTCH">Dutch</option>
<option value="ENGLISH">English</option>
<option value="FINNISH">Finnish</option>
<option value="FRENCH">French</option>
<option value="GERMAN">German</option>
<option value="HUNGARY">Hungarian</option>
<option value="ITALIAN">Italian</option>
<option value="JAPANESE">Japanese</option>
<option value="KOREAN">Korean</option>
<option value="NORWEGIAN">Norwegian</option>
<option value="POLISH">Polish</option>
<option value="PORTUGUESE">Portuguese Brazilian</option>
<option value="ROMANIAN">Romanian</option>
<option value="RUSSIAN">Russian</option>
<option value="SPANISH">Spanish</option>
<option value="SWEDISH">Swedish</option>
</select>
</p>
</div>
<h3>SOME PAGE TITLE</h3>
<ul class="operatorUL">
<li class="operatorLI" id="ZHT">Chinese Simplified
<ul class="mantop">
<li name="001a"><a class="mouseOn" onclick="getMenu('001');">SOME
NAME</a>
<ul class="manuals" id="001">
<li><a>Sorry, I cant show this, but sufficing to say its just a href
and name</a><li>
</ul>
</li>

....etc.

And then finally, here is the .js

function getMenu( id )
{
var parentId = id + "a";
var parent = document.getElementById(parentId);
var child = document.getElementById(id);

	if(child.name == "on")
		{
		parent.className = "norm";
		child.style.display = "none";
		child.name = "off";
		}
	else
		{
		parent.className = "on";
		child.style.display = "block";
		child.name = "on";
		}

}

function selectMenu()
{
var dropDown = document.getElementById("region");
var selectedText = dropDown.options[dropDown.selectedIndex].value;

var displayThis = document.getElementById(selectedText);

// Kills the old one
var killName = dropDown.name;
if(killName != "first")
{
var killThis = document.getElementById(killName);
killThis.style.display = "none";
}
// Creates New Ones;
displayThis.style.display = "block";
dropDown.name = selectedText;
}

function fop()
{

	var dropDown = document.getElementById("region");
	var firstName = dropDown.name;

	var fload = document.getElementById(firstName);
	 // fload.className = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
	fload.style.display = "block;";
}

0
lejason (5)
10/5/2007 6:56:09 PM
comp.lang.javascript 38370 articles. 0 followers. javascript4 (1315) is leader. Post Follow

6 Replies
3469 Views

Similar Articles

[PageSpeed] 5

porter wrote:
> While my question might be simple, the environment around it is
> terribly messy and so I will try to keep this clear and simple by only
> including the relevant code - however, as I will soon suggest, I worry
> that the problem isnt in what would seem to be the relevant code but
> instead is lost somewhere in the do-and-donts of the peripheral code.
> So at the end, i'll try to include all the affected code and you can
> see if any of its actually relevant.  I know there is a lot going on...
> sorry, but I tried to write this clearly.

Much ado about nothing.  Shakespeare would be proud of you ...

> So here is what I imagine to be relevant.

Finally.  I was just falling asleep.

> I'm working with a page that uses a very simple javascript function
> change the style of an <li> element (display=block;).  The code is
> simple...which is why I cant understand my problem.  This function
> is being called by <body onload="fop()">
> 
> // Javascript function
> 
> function fop()
> {
> 	var dropDown = document.getElementById("region");
> 	var firstName = dropDown.name;
> 	var fload = document.getElementById(firstName);
> 	fload.style.display = "block";
> }
> 
> //  This is where it grabs the name value.  "View Source" confrims the
> values work, (eg. name="ZHT")
> <select name="<%=Request.QueryString("lang")%>" id="region"
> onchange="selectMenu();">
> 
> 
> //This is one of the <li> tags
> <li class="operatorLI" id="ZHT">
> 
> 
> // Later for testing, I tried this (see below)
> <li class="operatorLI" id="ZHT" name="TESTME">
> 
> The result is this.  Firefox works, IE doesn't haha.

"Does not work" is a useless error description. [psf 4.11]

But let's see, maybe something interesting comes up eventually:

> In more detail, when I use alert() to "trace" [blabla] the progress
> of the function, the function doesnt break...but I can see where
> things, for whatever crack-head reason, start to go strange.  They go
> strange when I ask for the name value of "fload", Firefox correctly
> returns the name value of the <li> which would be "TESTME" while I
> returns the name value for the <select> tag which is "ZHT".

It is well-known among competent Web developers that NAME and ID attribute
values in a HTML document share the same namespace.  The MSHTML DOM
implements this concept weirdly, and handles `name' and `id' attribute
values much the same (even though the former are often of type CDATA).
There is nothing you can do about it.

However, in your case you will observe that the `li' element has no `name'
attribute (not even in HTML 4.01 Transitional), and so the MSHTML DOM is
correct, albeit in a weird way.

http://www.w3.org/TR/html401/struct/lists.html#h-10.2

> [...]...?!?!  what?!!?

Your keyboard appears to be borken, especially the `?' and `!' keys.
You should fix that if you want to be taken seriously in the future.

> Obviously, I played with this alot...and I cant seem to find the
> reason for it.  I tried taking out all the dynamic stuff and hard
> coding things - still, what the hell, it ALWAYS gives me the name
> value for the <select> tag as if it were completely ignoring
> getElementsById();

That is a known peculiarity of the MSHTML DOM.  The element that comes first
in the markup and has a matching `name' or `id' attribute value determines
which element object reference is returned with document.getElementById().

> So im guessing this has something to do with the way that im rendering
> things in C#.

Not at all.

> I know that IE is a little girl who, if things arent
> spelled out exactly right, crys and breaks.  So did I mess something
> up?  Is my onload() broken?  Seriously...im at a loss here.

You now "know" that you "know" far less than you thought you "know".
Guess what you will "know" tomorrow ...

> So, any ideas guys?
> 
> Well if that didn't help, here is the all the code (I added some
> comments so you could walk along with it).  There are three pages plus
> a javascript at the end.  Sorry, but I can't include the assembly

That's a pity.  It just got sooo interesting.  NOT.

> [...]
> PAGE 1 - ss.aspx:
> [more than 200 lines of mostly uncommented code]

You must be kidding.  Dump that junk where it belongs, not here.

http://jibbering.com/faq/


PointedEars, Score adjusted
-- 
"Use any version of Microsoft Frontpage to create your site. (This won't
prevent people from viewing your source, but no one will want to steal it.)"
  -- from <http://www.vortex-webdesign.com/help/hidesource.htm>
0
Thomas
10/5/2007 7:46:58 PM
Much ado about nothing.  Shakespeare would be proud of you ...

The glory of the internet is that you can appear much bolder than
really you are because no one is there to call you out.  But the fact
is kid, I am cooler than you, most likely more attractive (physically,
monetarily...etc) and more, I am apparently nicer than you.  I thought
that I would try to make something easier for people to read - it's
the niceties in life that make things a little more pleasant  :)  But
thank you for the compliment.

Finally.  I was just falling asleep.

I doubt it.  But context-irrelevant, there is a certain economy to
google groups that perhaps you've never noticed.  Kids like me, with
important things to do and lives to lead, post here in hopes that
other kids without important things to do, who wouldn't mind reading
over pages and pages of simple questions, will provide them answers
and sometimes even new ways of thinking about things.  Of course the
trade off is that we get the answers we need and you, after sifting
through the waste, can enjoy that one moment where you feel important;
everyone needs to feel loved I suppose. We both get what we want :)

"Does not work" is a useless error description.

Yeah, sorry about that.  The thing is that the English language is
pretty linear and I couldn't reference a subject that wasn't already
introduced.  But I agree, something less linear would have been a
better fit.

It is well-known among competent Web developers that NAME and ID
attribute
values in a HTML document share the same namespace.  The MSHTML DOM
implements this concept weirdly, and handles `name' and `id'
attribute
values much the same (even though the former are often of type
CDATA).
There is nothing you can do about it.

"well-known" to competent developers...eh, fine.  But for sure not
designers (who are becoming increasingly more important and better
paid while the former less and less) and not with the new "designers/
pseudo-developers" like myself.  More, im not sure how its relevant
beyond outside of the said economy but good to know!  I feel smarter
already!

Your keyboard appears to be borken, especially the `?' and `!' keys.
You should fix that if you want to be taken seriously in the future.

Clever...

Not at all.

Yeah, got it.

You now "know" that you "know" far less than you thought you "know".
Guess what you will "know" tomorrow ...

Yes, think what I will know.  I will know about this odd, completely
counter-intuitive facet to "standards" as well as numerous other
things...I cant wait! :)

That's a pity.  It just got sooo interesting.  NOT.

Now, I know we mentioned the google groups economy...but if you came
here looking for excitement (and not nerd-glory) then perhaps you came
to the wrong place?  I don't know...just thinking out-loud.

You must be kidding.  Dump that junk where it belongs, not here.

Noted.  Well, now that you sorted all that out for me, I am going to
go enjoy other parts of my life!  But please keep up the good work
reading all these posts and then taking the time to reply!

0
porter
10/6/2007 12:02:24 AM
On Oct 5, 2:56 pm, porter <leja...@gmail.com> wrote:
> So here is what I imagine to be relevant. I'm working with a page that
> uses a very simple javascript function change the style of an <li>
> element (display=block;).  The code is simple...which is why I cant
> understand my problem.  This function is being called by <body
> onload="fop()">

Not to be overly critical but you probably want to avoid using names
of only 3 characters in length.  It makes for less typing, but it's
harder for other people (and you, once you've been away for a couple
weeks) to quickly get a sense of what you are trying to accomplish.

Also consider using "unobtrusive JavaScript," it's very easy.  Just
instead of <body onload="myFunc()"> try this inside your JavaScript
include or SCRIPT tag:

window.onload = myFunc;

This keeps your markup and behavior separate, which is nice if you
want to switch to a different set of behaviors (or markup) later on.

>
> // Javascript function
>
> function fop()
> {
>         var dropDown = document.getElementById("region");
>         var firstName = dropDown.name;

Just use dropDown.id instead of dropDown.name and your problems should
go away.  The NAME attribute is only for forms, and iirc is deprecated
and should go away in future versions of the HTML spec.

> // Later for testing, I tried this (see below)
> <li class="operatorLI" id="ZHT" name="TESTME">

If you do use NAME, the spec says the NAME you use should be the same
as the ID.  But again, that would only be for backward compatibility
on a form.  You don't need or want a NAME attribute here, nor is it
valid HTML.  One thing that might help you in the future is the w3's
HTML validator.  Run your page through this, and get rid of all the
errors before you spend time debugging your JS.  Trying to get JS to
run on invalid markup is a waste of your valuable time.

http://validator.w3.org/

Now, if for some reason you did want another identifier besides the
ID, you could use a class name, or perhaps a REL attribute.  But if
you've got meta-data you want associated with an element, imo it's
cleaner to build a JavaScript data structure to use as a  lookup
table.  Consider using the elements' IDs as your keys.  This keeps
your markup free of mysterious cruft (that will just slow down the
poor person who inherits your code later on) and is more flexible:

var lookup = {
  ZHT: "TESTME",
  foo: "my meta-data",
  bar: ['more', 'complex', 'meta', 'data']
}

//then for a trivial example, if ZHT were the first LI element in your
document
var myLiId = document.getElementsByTagName('li')[0].id;
var myLiName = lookup[ myLiId ];  //the value of myLiName is now
'TESTME'


> im actually a
> flash developer and damnit, I need my trace()

then you would probably love the Firebug Firefox extension, which
actually provides trace(), along with many other useful debugging
tools, including a console that is much more convenient than using
alert().

http://www.getfirebug.com/console.html

>  I know that IE is a little girl

that is an insult to little girls ;)

good luck with your coding



0
Noah
10/6/2007 4:06:52 AM
On Oct 5, 2:56 pm, porter <leja...@gmail.com> wrote:
> So here is what I imagine to be relevant. I'm working with a page that
> uses a very simple javascript function change the style of an <li>
> element (display=block;).  The code is simple...which is why I cant
> understand my problem.  This function is being called by <body
> onload="fop()">

Not to be overly critical but you probably want to avoid using names
of only 3 characters in length.  It makes for less typing, but it's
harder for other people (and you, once you've been away for a couple
weeks) to quickly get a sense of what you are trying to accomplish.

Also consider using "unobtrusive JavaScript," it's very easy.  Just
instead of <body onload="myFunc()"> try this inside your JavaScript
include or SCRIPT tag:

window.onload = myFunc;

This keeps your markup and behavior separate, which is nice if you
want to switch to a different set of behaviors (or markup) later on.

>
> // Javascript function
>
> function fop()
> {
>         var dropDown = document.getElementById("region");
>         var firstName = dropDown.name;

Just use dropDown.id instead of dropDown.name and your problems should
go away.  The NAME attribute is only for forms, and iirc is deprecated
and should go away in future versions of the HTML spec.

> // Later for testing, I tried this (see below)
> <li class="operatorLI" id="ZHT" name="TESTME">

If you do use NAME, the spec says the NAME you use should be the same
as the ID.  But again, that would only be for backward compatibility
on a form.  You don't need or want a NAME attribute here, nor is it
valid HTML.  One thing that might help you in the future is the w3's
HTML validator.  Run your page through this, and get rid of all the
errors before you spend time debugging your JS.  Trying to get JS to
run on invalid markup is a waste of your valuable time.

http://validator.w3.org/

Now, if for some reason you did want another identifier besides the
ID, you could use a class name, or perhaps a REL attribute.  But if
you've got meta-data you want associated with an element, imo it's
cleaner to build a JavaScript data structure to use as a  lookup
table.  Consider using the elements' IDs as your keys.  This keeps
your markup free of mysterious cruft (that will just slow down the
poor person who inherits your code later on) and is more flexible:

var lookup = {
  ZHT: "TESTME",
  foo: "my meta-data",
  bar: ['more', 'complex', 'meta', 'data']
}

//then for a trivial example, if ZHT were the first LI element in your
document
var myLiId = document.getElementsByTagName('li')[0].id;
var myLiName = lookup[ myLiId ];  //the value of myLiName is now
'TESTME'


> im actually a
> flash developer and damnit, I need my trace()

then you would probably love the Firebug Firefox extension, which
actually provides trace(), along with many other useful debugging
tools, including a console that is much more convenient than using
alert().

http://www.getfirebug.com/console.html

>  I know that IE is a little girl

that is an insult to little girls ;)

good luck with your coding



0
Noah
10/6/2007 4:07:07 AM
porter wrote:
> Much ado about nothing.  Shakespeare would be proud of you ...

You didn't wrote that; I did.  But it is obvious you are far too
stupid to quote properly:

> The glory of the internet is that you can appear much bolder than
> really you are because no one is there to call you out. [blabla]

*PLONK*
0
Thomas
10/6/2007 8:39:00 AM
Noah Sussman wrote:
> On Oct 5, 2:56 pm, porter <leja...@gmail.com> wrote:
>> So here is what I imagine to be relevant. I'm working with a page that
>> uses a very simple javascript function change the style of an <li>
>> element (display=block;).  The code is simple...which is why I cant
>> understand my problem.  This function is being called by <body
>> onload="fop()">
> 
> Not to be overly critical but you probably want to avoid using names
> of only 3 characters in length.  It makes for less typing, but it's
> harder for other people (and you, once you've been away for a couple
> weeks) to quickly get a sense of what you are trying to accomplish.
> 
> Also consider using "unobtrusive JavaScript," it's very easy.

No, don't.  It's inherently error-prone.

> Just instead of <body onload="myFunc()"> try this inside your JavaScript
> include or SCRIPT tag:

`script' _element_

> window.onload = myFunc;

Proprietary, unnecessary nonsense.

> This keeps your markup and behavior separate, which is nice if you
> want to switch to a different set of behaviors (or markup) later on.

DOM scripts operate on specific markup.  It does not make sense to separate
markup and DOM script.  DOM scripting isn't quite like stylesheets.

>> // Javascript function
>>
>> function fop()
>> {
>>         var dropDown = document.getElementById("region");
>>         var firstName = dropDown.name;
> 
> Just use dropDown.id instead of dropDown.name and your problems should
> go away.

Most certainly they will.  But then

  var firstName = "region";

would have sufficed.

> The NAME attribute is only for forms,

Nonsense.  Not only form controls have a `name' attribute:

http://www.w3.org/TR/html401/index/attributes.html

> and iirc is deprecated

You remember incorrectly.  It is even there in XHTML 1.1:

http://www.w3.org/TR/2000/CR-xhtml-modularization-20001020/dtd_module_defs.html#a_dtdspecial

It is deprecated in HTML 4.01 _for the `applet' element_ only, see above.
It is not even deprecated for `a' elements in XHTML 1.0:

http://www.w3.org/TR/xhtml1/dtds.html#dtdentry_xhtml1-strict.dtd_a

The subsection http://www.w3.org/TR/xhtml1/#h-4.10 which contains

| Note that in XHTML 1.0, the name attribute of [ elements is formally
| deprecated, and will be removed in a subsequent version of XHTML.

is part of the non-normative section 4, and so the DTD takes precedence.

> and should go away in future versions of the HTML spec.

Utter nonsense, see above.

>> // Later for testing, I tried this (see below)
>> <li class="operatorLI" id="ZHT" name="TESTME">
> 
> If you do use NAME, the spec says the NAME you use should be the same
> as the ID.

Utter nonsense.  That applies for `a' elements only:

http://www.w3.org/TR/html401/struct/links.html#h-12.2.3

> But again, that would only be for backward compatibility
> on a form.

Utter nonsense.  The value of form controls that have only an ID is not
submitted in XHTML 1.x, too:

http://www.w3.org/TR/html401/interact/forms.html#h-17.13.3

> You don't need or want a NAME attribute here, nor is it
> valid HTML. One thing that might help you in the future is the w3's
> HTML validator.  Run your page through this, and get rid of all the
> errors before you spend time debugging your JS.  Trying to get JS to
> run on invalid markup is a waste of your valuable time.
> 
> http://validator.w3.org/

That, at last, is true.

> Now, if for some reason you did want another identifier besides the
> ID, you could use a class name,

Yes.

> or perhaps a REL attribute.

That would most certainly constitute abuse of that attribute:

http://www.w3.org/TR/html401/struct/links.html#adef-rel

For HTML `li' elements, it would also constitute invalid markup:

http://www.w3.org/TR/html401/struct/lists.html#h-10.2
http://www.w3.org/TR/html401/sgml/loosedtd.html


PointedEars
-- 
var bugRiddenCrashPronePieceOfJunk = (
    navigator.userAgent.indexOf('MSIE 5') != -1
    && navigator.userAgent.indexOf('Mac') != -1
)  // Plone, register_function.js:16
0
Thomas
10/6/2007 10:03:24 AM
Reply:

Similar Artilces:

javascript within a javascript
Hello, I have a multi-frame page. The frames are named Frame_1, Frame_2 and Frame_3. Frame_1 has a drop down box. When a value is selected in this drop down box, Frame_2 is updated using an asp file (as I have to read from a back-end access database). In turn in the asp file, I have a Body onload tag to execute a javascript function within Frame_2. this function updates the contents of Frame_3. Till now this is working fine. Here is the problem. Frame_3 has a form with a radio button. When a radio button is selected, I want that a function be executed in Frame_3. However since conte...

dynamic load javascript from javascript
hi, from here: http://www.activewidgets.com/javascript.forum.6114.15/dynamic-load-javascript-from-javascript.html there is a method to load js from js, e.g. //--------------------------------------------------------------------------------------- var script = document.createElement('script'); script.type = 'text/javascript'; script.src = 'snip.js'; document.getElementsByTagName('head')[0].appendChild(script); //--------------------------------------------------------------------------------------- this method works great, but there is a bug(?) when using wit...

JavaScript
If I have Options/ViewingMail/AllowExecutables unchecked does Eudora strip out the JavaScript? Or just refuse to execute it? TIA... Bob "Bob Bailey" <ebiz@usa.net> wrote in message news:rfOdnaRVycZZNzXenZ2dnUVZ_v-dnZ2d@rcn.net... > If I have Options/ViewingMail/AllowExecutables unchecked does Eudora strip > out the JavaScript? Or just refuse to execute it? OK. I've answered my own question but that begs a new one. (Eudora strips the JS.) Having allowed Executables it only works if I open, not preview, the message and then it insists on ope...

Javascript
Hello people, I'm trying to make a regional map in html and javascript, I'm sure how to d= o the following: to hover over the city, he should change the city's image with another clea= rer, and clicking in the city he should get a darker color than the picture= when we hover. Until there all right, but when I click it gets darker image and move the m= ouse in another city he immediately removes the dark image and return to th= e clearer picture. How to keep the image when I click on it and still the effect of passing th= e mouse? --------------------- the other t...

Javascript
Recently, I have had the role of being the Javascript guru at work. You know, one peeve I have about COLA is that it seems too oriented around client applications, when the the majority of the world is about Web applications. We talk about OO -- but javascript has always been there. As has DOM, and DHTML. A web developer is a fully OO programmer. In article <5%LCb.2953$Pg1.2136@newsread1.news.pas.earthlink.net> John Bailo <ten@lnilhtrea.oliabaj> wrote: >Recently, I have had the role of being the Javascript guru at work. For single man garage business, you sure have. ...

JavaScript
Javascript has it's own significance Amit Patel wrote: > Javascript has it's own significance Mr Patel, Stop using that stuff, it's bad for your brains. :P "Amit Patel" <amit2749@hotmail.com> wrote in message news:5f04ccb8.0401210427.3f93300c@posting.google.com... | Javascript has it's own significance It also has it's own group.. news:comp.lang.javascript ...

javascript
Hi all I wounder if some one can help me i have to write a program that sums numbe3rs together using a for loop. The numbers are 1 to 10 then one to 20 then 1 to 10,000. // A program for summing numbers from one to biggestNumber Var biggestNumber; Var theSum = 0; its got to start like this. Im having problems with this one viicki -- v davies Message posted via JavaKB.com http://www.javakb.com/Uwe/Forums.aspx/java-tools/200512/1 On Fri, 16 Dec 2005 11:27:29 GMT, "vicki via JavaKB.com" <u16404@uwe> wrote, quoted or indirectly quoted someone who said : >// A program fo...

Javascript
Would anyone know whether Javascript works well with sound files? Tina Host wrote: > Would anyone know whether Javascript works well with sound files? Exactly as well as it works with files of any other type. -- |_ CJSonnack <Chris@Sonnack.com> _____________| How's my programming? | |_ http://www.Sonnack.com/ ___________________| Call: 1-800-DEV-NULL | |_____________________________________________|_______________________| ...

javascript
Cut'n'paste from "my" ticket 202 at www.ecomstation.com as they seem to have come to a halt... :-( ################################ Recenty I went from w4 fp17 to eCS 1.2. I get the odd behavior described beneath. Both boxes sees, and uses the same installations and user profiles. Clean install(s) of both Moz and FF has been done several times. Starting FF or Moz clean (no userprofiles), doesn't make any differnce. FIREFOX: The Weather extension i.e doesn't show it's 'mouseover' info, and it refreshes slow. Unit change which ...

JavaScript
Guys, anybody know if is possible "to press" a button linked a javascript function using python? My Firefox send something like that: POST /msgs.aspx TOKEN=B8B83BGDBC191B9FE0A0BE1393294FAB&sig=gpaiOqbp0Nr %2BoecRLF4FGGDOAao %3D&toUserId=1331299&rawAddedDate=1188546666&fromUserId=23029&Action.delete=Send +data python has modules for forms and other things... and for it? Thank you for help... zowtar >python has modules for forms and other things... and for it? Check out httplib and urlib2, it might be useful for you. Hi! I know "how to", but o...

Nixing Javascript via javascript: pseudoproto?
This is a question about defensive web browsing. Ocassionally I run into a page whose JavaScript does something that I find obnoxious. I would like to turn off JavaScript only for that page (instead of disabling it globally). It would be cool if there were some way to do this through a "bookmarkable" JavaScript snippet using the javascript: pseudoprotocol. Does anyone know any trick to do any of this? Many thanks! -bill "bill" wrote > This is a question about defensive web browsing. Ocassionally I > run into a page whose JavaScript does something that I fi...

Javascript Caret Position in DIV
Hi All, I am looking for a way to get and set the caret position in an editable DIV. I have tried using the TextRange option, this is using the document.selection.createRange() function. The problem is that the TextRange object is sometimes shared in memory, and consequently one modification of the TextRange will affect another. I am using this to implement a javascript clipboard, so I have to be able to save the TextRange objects to restore any changes made to the DIV content when the user hits CTRL Z. Alternately, does anyone know of a good javascript clipboard? The default one does not ...

where are the javascripts?
On the link below: http://www.zytrax.com/books/dns/ I couldn't find the javascript codes (mouseover) needed for the Dynamic HTML menu at the top of the page. How did the site hide those codes? -- .~. Might, Courage, Vision. In Linux We Trust. / v \ http://www.linux-sxs.org /( _ )\ Linux 2.4.22-xfs ^ ^ 9:04pm up 2 days 11:31 load average: 1.08 1.20 1.08 toylet wrote: > On the link below: > > http://www.zytrax.com/books/dns/ > > I couldn't find the javascript codes (mouseover) needed for the > Dynamic HTML menu at the top of the page. How did the ...

Including a javascript relative to its own location from another javascript
Hello, I want to include a javascript from another javascript. I know that I can do that by document.write("<script src='another.js'>"); I am exposing my main.js (which contains the above code) directly, intending it to be used via cross-site scripting (xss). In this case, the above code doesn't work. Because an external html which is using my main.js will look for another.js in its local directory. I have to change 'another.js' to '<absolute path>/another.js' for it to work. But now if I change the location of main.js I have to make chang...

javascript and []
<form name=f> <input type=text name="apple[]" value=1> </form> <script> document.f.apple[].value=2 </script> /////////////////////////// this generates an script error in IE because of apple[] so how do I get around the error? (must use "apple[]" for server cgi) thanks in advance :) document.getElementsByName("apple[]") //returns an object array -- www.vicdir.com <apple@apple.com> д���ʼ� news:ccpv0f$440$3@news.seed.net.tw... > <form name=f> > <input type=text name="apple[]" value=1> > <...

assigning session a javascript value in javascript function
Hello Guyz.. I want to assign a varascript value to a session object in javascript function... like i have an image and onClick i am calling a function sort_(str).. Now i want to assign this value str to a session object in the same function... I know javascript code is client side and session is on server side.. but is there any way doing that?? function sort_(str) { document.ins_form.elements["Qry"].value = str; //alert(str); document.form1.submit(); } when i click on that image and that function calls everything works fine. but when i click on next to bring more records i c...

tricky javascript problem requires javascript guru !
Hi, I am complete JavaScript novice and would really appreciate some help with this code: ===================================================================== <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> <!--#include file="Connections/ssdb.asp" --> <% Dim rs_news_edit Dim rs_news_edit_numRows Set rs_news_edit = Server.CreateObject("ADODB.Recordset") rs_news_edit.ActiveConnection = MM_ssdb_STRING rs_news_edit.Source = "SELECT * FROM tblnews" rs_news_edit.CursorType = 0 rs_news_edit.CursorLocation = 2 rs_news_edit.LockType = 1 r...

JavaScript?
I have a question, and I hope this one hasn't been asked too frequently; if so, I apologize in advance. I've heard over time that it isn't a good idea to intermingle JavaScript with PHP code. Maybe that's a fallacy, and maybe not, but if so, would someone care to enlighten me as to why this might be the case? Thanks in advance for any responses. -- Randy Jackson http://fourcolorexplosion.com On Sat, 10 Jul 2004 16:32:43 GMT, Randy Jackson <randyjackson@ignorethispartfourcolorexplosion.com> wrote: >I have a question, and I hope this one hasn't been asked t...

Javascript?
Why is it that we can not have Javascript on RiscOS? Simply please. Dave. -- D In message <27bce4234f.David@mail.daveandsylvia.plus.com> Dave <mail@daveandsylvia.plus.com> wrote: > Why is it that we can not have Javascript on RiscOS? Simply please. > Dave. We do have Javascript: - Firefox Oregano 1 and 2 WebsterXL Fresco I believe with the exception of Firefox, all the other browsers feature either incomplete or non current versions of Javascript Someone please feel free to correct me, but I do not believe any of the above browsers are ...

javascript and IE
how can i maximise the internet explorer when i call a jsp page. On 6 May 2004 00:47:53 -0700, mihirdm@rediffmail.com (mihir maniar) wrote: >how can i maximise the internet explorer when i call a jsp page. I *think* this will work: window.resizeTo(((screen.width/2)*2),((screen.height/2)*2)) Note the redundancy as space holders for making modifications. mike rule of thumb: resize the height to screen height - (+/- 30) and position window to 0,0 else the rest of the window will sit below the taskbar, and it'll position itself in the next reserved cascade position "Mike Prest...

JavaScript under IE?
I'm running 9.2.2 and the latest IE (5.1.7) for the OS. For the last couple of days, JavaScript seems to be broken under IE. It seems OK for Netscape, but not IE. I upgraded from IE 5.1.6 to 5.1.7 in the hopes that JavaScript would update, too, but that didn't help. What needs replacing? From what source? Thanks. -- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Brian Gordon -->briang@panix.com<-- <This space for rent> | + Bass: Greater Phoenix Chapter "Pride of Phoenix" Chorus + -+-+-...

Javascript with %%%%%%?
Hi,I had this guy post some spam to my site and now I'm on a mission tofind out who it is. He's got a site that redirects you elsewhere, inthat site I hit stop on the browser so I could see it. It containedthis script:SCRIPT type='text/javascript'>var ibnfbpy="%3c%73c%72%69pt%20"+""+"%74%79"+"p%65%3d%27%74ex"+"%74%2f%6a%61%76%61s%63%72%69%70%74%27%3e%0a%77i%6ed%6f%77%2e%6c%6f%63a%74%69%6fn%2e%68%72ef%3d%22%68t%74%70%"+"3a%2f%2f"+"%78%61%6e%61x%37%37%37"+"%70%69%6c%6c%73%2e%63o%6d%2f%71%2eph%"+&...

About Javascript.
I wish to know more about javascript. Hope that have somebody can help me solve this problem. Just tell me which types of javescript is easy to learn and easy to use. Thank. "Joanne" <Joanne_9989@yahoo.com.sg> wrote in message news:bi3ulh$id7$1@ftp.curtin.edu.au... > I wish to know more about javascript. Hope that have somebody can help me > solve this problem. Just tell me which types of javescript is easy to learn > and easy to use. Thank. There *technically* is only one type of javascript - so I would suggest learning that one - there is a great beginners prime...

The JavaScript Planet! There are now 789 JavaScripts available
WELCOME to The JAVASCRIPT PLANET which is a page where I plan to publish as many JavaScripts (and maybe some other cool stuff like VRML, Animated GIFs) as possible, please contribute a JavaScript if you've got something useful. Just paste the code into the textbox and push the Send button! Your contribution will be published on a separate page, with your name and comment, within a week (usually). ...

Web resources about - Javascript and IE? Javascript and C#? - comp.lang.javascript

JavaScript Kit- Your comprehensive JavaScript, DHTML, CSS, and Ajax stop
Your comprehensive JavaScript, DHTML, CSS, and Ajax stop

Let's Code: Test-Driven Javascript by James Shore — Kickstarter
James Shore is raising funds for Let's Code: Test-Driven Javascript on Kickstarter! A screencast series focusing on rigorous, professional Javascript ...

Eloquent JavaScript: A Modern Introduction to Programming
... and pragmatics. I loved the tutorial-style game-like program development. This book rekindled my earliest joys of programming. Plus, JavaScript! ...

Lightbox (JavaScript) - Wikipedia, the free encyclopedia
On a Lightbox-enabled page, a user can click an image to have it magnified in a Lightbox window, which resizes itself according to the size of ...

Open Directory - Computers: Programming: Languages: JavaScript: Tools: Obfuscators
about dmoz - help Top : Computers : Programming : Languages : JavaScript : Tools : Obfuscators Tools for obfuscation/compression JavaScript code. ...

Facebook Open-Sources JavaScript Static-Type Checker Flow
The latest software to be open-sourced by Facebook is Flow , a static-type checker for JavaScript . (more…) New Career Opportunities Daily: ...

Under the Hood: The JavaScript SDK - The use of polyfills - Facebook
Facebook Engineering hat eine Notiz mit dem Titel Under the Hood: The JavaScript SDK - The use of polyfills geschrieben. Du kannst den vollständigen ...

Quickstart: Facebook SDK for JavaScript
This quickstart will show you how to setup the SDK, load social plugins, trigger a dialog, and get it to make some basic Graph API calls.

Facebook App Devs Get Javascript
It has been an oft-lamented fact of the Facebook Platform thus far in its life that, in order to use all but the most simple of Javascript functionality–the ...

Badass JavaScript (@badass_js) on Twitter
WebGLWorker is an open source library that allows using WebGL from Web Workers. Great work as always from @kripken . blog.mozilla.org/research/2014/… ...

Resources last updated: 3/12/2016 5:44:29 AM