[thelist] Avoid "#" and "onclick" in "<a href"

Stefan Schwarzer st.schwarzer at geois.de
Fri Mar 24 03:55:01 CST 2006


Hi there,

after a long time of adding, changing, optimizing etc. my code, I  
wanted to validate it with the XHTML validator of W3C. It was passing  
the test quite well. I had to change he onClick to onclick, which  
isn't too much asked for. But when I was searching the Net for the  
"right" - i.e. correct - use of

                  a href="#" onclick="..."

I was stumbling over this article: http://evolt.org/ 
Links_and_JavaScript_Living_Together_in_Harmony

Now, I am willing to learn and change. Yes. And I am honest in saying  
that I use these onclicks a lot. An example is below. I have a rather  
complex site - for searching, displaying, analyzing data. To access  
different "modules" from one page I actually use one single,  
"generic" form. I just change the action item via the onclick-tag.  
Or, for changing the language, I use this too.

I guess I could put some of the code I use in the onclick-tag into a  
separate javascript function. But still, I don't see how I can avoid  
the "#"-reference.

Any ideas or suggestions?

Thanks for your help.

________________________________________________________________________ 
____

<a class="linksWhite2" href="#"  
onclick="document.formGeneric.selectedLanguage.value='en';  
document.formGeneric.action='<?=$currentPage;?>';  
document.formGeneric.submit();">English</a>&nbsp;|
<a class="linksWhite2" href="#"  
onclick="document.formGeneric.selectedLanguage.value='fr';  
document.formGeneric.action='<?=$currentPage;?>';  
document.formGeneric.submit();">Français</a>&nbsp;


<a class="linkBlueSmall" href="#"  
onclick="document.formGeneric.action='index_advanced.php';  
document.formGeneric.selectedLanguage='en';  
document.formGeneric.submit();" title="Specify your search by  
limiting it to selected themes, regions or date of  
updates."><b>Advanced Search</b></a>

________________________________________________________________________ 
____



More information about the thelist mailing list