[thelist] Avoid "#" and "onclick" in "<a href"
VOLKAN ÖZÇELİK
volkan.ozcelik at gmail.com
Fri Mar 24 07:03:31 CST 2006
First of all, assigning classes non-contextual names will most probably
cause headaches in the future.
What if you changed your page color scheme and all your white links are now
purplish orange. Assigning a class named "linksWhite" will be rather
confusing to the developer and the designer.
Instead <a class="linkMain" ... <a class="linkSubNavigation" ... etc would
be a much wiser choice.
imho the ideal way of dealing with onclick is:
<input type="hidden" id="hiddenparam" value="<?=$serverSideRequiredParam;?>"
<a id="MyLovelyLink" class="linksWhite2"
href="/ServerSideLogicPage.php?action=linkClicked&otherparams">English</a>
page.js
---
window.onload=function()
{
document.getElementById("MyLovelyLink").onclick=MyLovelyLink_click;
/*
Or doing something more fashionable nowadays, like using a wrapper object:
EventHandler.addEventListener("MyLovelyLink","click",MyLovelyLink_click);
*/
};
function MyLovelyLink_click(evt)
{
document.formGeneric.action='';
document.formGeneric.submit();"
return false;/*to cancel event propagation.
this can better be done via a helper object like
new EventObject(evt).cancelDefaultAction();
*/
};
HTH,
--
Volkan Ozcelik
+>Yep! I'm blogging! : http://www.volkanozcelik.com/volkanozcelik/blog/
+> My projects/studies/trials/errors : http://www.sarmal.com/
More information about the thelist
mailing list