<label><label/> - tag in <A><A/> - tag mit javascript-Funktion auf der href nicht ausgeführt

Ich habe eine <label><label/> tag in <A><A/> tag, die <A> tag hat eine href , ruft eine JavaScript-Funktion.

Das JavaScript schlägt fehl, rufen Sie bei der Ausführung unter IE, aber funktioniert ein Leckerbissen auf alle anderen brauche ich es auch.

Ich weiß, das ist wahrscheinlich nicht normal, aber ich bin auf der Suche nach einem speech reader, quick-fix, um einen wirklich alten Projekt, so können nicht in das warum und warum nicht. 🙂

Habe ich durchsucht und finde keinen Hinweis darauf, warum dies nicht funktioniert, hier mein test-code.

<!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

Schreibe einen Kommentar