Event.observe prototype iexplorer problem

M

mithaelin

ok, I can't get out of this riddle and Google seems can't help me.
The problem is that this code doesn't work in iexplorer while it's
perfect in other browser (didn't check in safari):
<html>
<head>
<script src="include/js/scriptaculous/lib/prototype.js"></script>
<script src="include/js/scriptaculous/src/scriptaculous.js"></script>
<script type="application/javascript" language="javascript">
function goofy(id) {
var linkList = $(id).getElementsByTagName('a');
var tmp;
var j;
while (tmp=linkList[j++]) {
if (tmp.rel=='bar') alert ('yes');
else alert ('no');
}
}
</script>
</head>

<body id="corpse">
<a href="http://www.foo.bar" rel="bar">foo</a>
<a href="http://www.foo.bar">foo</a>
</body>
<script type="application/javascript" language="javascript">
var init=goofy('corpse');
Event.observe(window,'load',init);
</script>
</html>

Now, what's the point?
I'm sure it isn't a prototype problem so it's my fault, but where?
Do you have any hint?
Do you have some offence for my incompetence (but only in combo with
hint)?

thank you for patience
 
H

Henry

<script type="application/javascript" language="javascript">
<snip>

The MIME type application/javascript was introduced in (mid) 2006. It
can not be recognised by any browser released before that date, and
may not be recognised by some released after that date. The
probability is that these now MIME types for javascript will not be
viable for use in mark-up for at least 3-4 years. For script elements
the type "text/javascript" will either be sensibly understood or
harmlessly ignored.

Richard.
 
R

RobG

ok, I can't get out of this riddle and Google seems can't help me.
The problem is that this code doesn't work in iexplorer while it's
perfect in other browser (didn't check in safari):

I didn't check the code itself, but I think Henry is correct about
type="application/javascript". IE doesn't like it, for the record
Safari 3 thinks it's fine but earlier versions likely barf.

type="text/javascript" is deprecated, however if you want your HTML to
validate you have to use something, and that at least is tolerated by
most - if not all - browsers.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top