Une fonction show('id')
<script type="text/javascript">
<!--
var tmp = show('NomIdInput').value
alert(tmp)
// ----------------------------------------
// FONCTION > POur tous les Navigateurs: show(id)
var ns4 = (document.layers)? true:false;
var ie4 = (document.all)? true:false;
var dom = (document.getElementById)? true:false;
function show(id){
if (dom) obj = document.getElementById(id);
else if (ie4) obj = document.all[id];
else if (ns4) obj = document.anchors[id];
return obj;}
// ----------------------------------------//-->
</script>
ET window.location.hash Cliquer sur une ancre au chargement de la page:
<script type="text/javascript">
<!--
// ----------------------------------------
if (window.location.hash)
{ // alert(window.location.hash);
// Enlever le dièse:
var reg1 = /#/gi;
var str=window.location.hash;
var resulta_ancre= str.replace(reg1,"");
// Cliquer sur le lien:
if (resulta_ancre!='')
show(resulta_ancre).onclick();
// Le lien est du type: <a href="" id="NomAncre"></a>
}
// ----------------------------------------
//-->
</script>
exemple:
http://lapage#NomAncre
<a href="javascript:" id="NomAncre" onclick="MaFonction()">Texte</a>
NomAncre