You are here: Re: CSS & Div Tag, Hyperlinked? « HTML « IT news, forums, messages
Re: CSS & Div Tag, Hyperlinked?

Posted by Jonathan N. Little on 10/10/06 01:53

Yogi_Bear_79 wrote:

> Currently I have it as an SSI. IE is claiming Line 12 Char 5 is the
> problem, Below is the .js file I have it saved as.

That's cuz (da-da-da tah) IE does support "addEventListener". And you
thought this would be easy ;-) No IS has its own proprietary command
"attachEvent" so you need to make some changes to your script...

> I call the SSI inside
> the <head> tag like this <SCRIPT language=JavaScript1.2
^^^^^^^^^^^^^
Get rid of the "language" attribute and use the required "type" attribute:

<script type="text/javascript" src="includes/ULeft.js"></script>

> src="includes/ULeft.js"></SCRIPT>. I have other SSI's called in similar
> fashion that work. So I don't think it is my test server. I would prefer to
> run it as an SSI. Thanks for your time
>
> // JavaScript Document
>
> function click()
> {
> location = "http://www.google.co.uk";
> }
>
> function main()
> {
> var e = document.getElementById("ULeft");
> e.addEventListener("click", click, false);
> }
>
> onload = main;


function main(){
var e=document.getElementById("ULeft");
if(e.addEventListener){ //modern browsers
e.addEventListener("click", click, false);
}
else if(e.attachEvent){ //MS IE support
pn.attachEvent('onclick', click); //NOTE: 'onclick' not 'click'
}
}

//now the proper way to initialize listener when document loads
if( window.addEventListener ) {
window.addEventListener('load', main, false); //legacy on WINDOW OBJ
} else if( document.addEventListener ) {
document.addEventListener('load', main, false); //proper W3C
} else if( window.attachEvent ) {
window.attachEvent("onload", main); // Special for IE only
}



--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация