<label><label/> à l'intérieur de la balise <A><A/> tag avec fonction javascript sur le href échec de l'exécution d'

J'ai un <label><label/> balise à l'intérieur de <A><A/> tag, le <A> balise a un href qui appelle une fonction JavaScript.

Le JavaScript ne parvient pas à appeler lors de l'exécution sous IE, mais fonctionne un régal sur tous les autres, j'en ai besoin aussi.

Je sais que ce n'est probablement pas normal, mais je suis à la recherche d'un discours lecteur de solution rapide pour un très vieux projet, donc permet de ne pas entrer dans le pourquoi et pourquoi pas de la. 🙂

J'ai cherché et ne peux trouver aucune référence à pourquoi cela ne fonctionne pas, voici mon code de test.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Label and Links Test For Speech Readers</title>
</head>

<script language="javascript" type="text/javascript">
    function onHello()
    {
        alert("hello");
    }    
</script>

<body>
    <p><b>Label and Links Test For Speech Readers</b></p>
    <p>This is a test a patch to an historic application, Tested with Chrome, Firefox, IE & BlackBerry OS-6(similator)</p>
    <p>
        # TEST 1<br />
        <a href="javascript:onHello();">Hello1</a>
        <br />Current basic link style, that doesn't work with speech readers
    </p>
    <p>
        # TEST 2<br />
        <a href="javascript:onHello();"><label style="cursor:pointer">Hello2</label></a>
        <br />Easy fix, but this does not work for IE
    </p>
    <p>
        # TEST 3<br />
        <label onclick="javascript:onHello();" style="color: #0000ff; text-decoration: underline; cursor: pointer;">Hello3</label>
        <br />More work to fix, but compatible with all noted broswers
    </p>
</body>
</html>
InformationsquelleAutor DIGGIDY | 2012-11-30