PHP Forum

PHP Forum (http://www.selfphp.de/forum/index.php)
-   HTML, CSS und JavaScript Help! (http://www.selfphp.de/forum/forumdisplay.php?f=24)
-   -   Javascript läuft nicht - nur warum? (http://www.selfphp.de/forum/showthread.php?t=25430)

hoseonline 12.11.2014 17:23:50

Javascript läuft nicht - nur warum?
 
Hi,

ich habe ein einfaches Javascript, welches über einen Button prüft was in einem Formular ausgewählt wurde.

Hier das Javascript:
Code:

<script type="text/javascript">
               
                    <?php //Funktion bei mouseover ?>
                    function checkForm1()
                    {
                        if(document.Formular.customPrice06){
                    if(document.Formular.customPrice06.value=="custom_value")
                    {
                    document.all.image.style.display = "block";
                                }}
                       
                        if(document.Formular.customPrice012){
                    if(document.Formular.customPrice012.value=="custom_value")
                    {
                    document.all.image.style.display = "block";
                                }}               
                               
                            if(document.Formular.customPrice010){
                    if(document.Formular.customPrice012.value=="custom_value")
                    {
                    document.all.image.style.display = "block";
                                }}               
                               
                            if(document.Formular.customPrice09){
                    if(document.Formular.customPrice012.value=="custom_value")
                    {
                    document.all.image.style.display = "block";
                                }}               
                               
                    }
                   
                   
                    <?php //Funktion bei mouseout ?>
                    function checkForm2()
                    {
                        if(document.Formular.customPrice06){
                    if(document.Formular.customPrice06.value=="custom_value")
                    {
                    document.all.image.style.display = "none";
                                }}
                               
                                if(document.Formular.customPrice012){
                    if(document.Formular.customPrice012.value=="custom_value")
                    {
                    document.all.image.style.display = "none";
                                }}
                               
                                if(document.Formular.customPrice010){
                    if(document.Formular.customPrice010.value=="custom_value")
                    {
                    document.all.image.style.display = "none";
                                }}
                               
                                if(document.Formular.customPrice09){
                    if(document.Formular.customPrice09.value=="custom_value")
                    {
                    document.all.image.style.display = "none";
                                }}
                               
                    }
                   
                   
                    <?php //Funktion bei mouseclick ?>
                    function checkForm()
                    {
                       
                            if(document.Formular.customPrice06){
                    if(document.Formular.customPrice06.value=="custom_value")
                    {
                    alert ("Bitte wählen Sie Größe/Länge aus");
                    return false;
                                }}
                            if(document.Formular.customPrice012){
                    if(document.Formular.customPrice012.value=="custom_value")
                    {
                    alert ("Bitte wählen Sie eine Größe aus");
                    return false;
                                }}
                            if(document.Formular.customPrice010){
                    if(document.Formular.customPrice010.value=="custom_value")
                    {
                    alert ("Bitte wählen Sie eine Farbe aus");
                    return false;
                                }}
                            if(document.Formular.customPrice09){
                    if(document.Formular.customPrice09.value=="custom_value")
                    {
                    alert ("Bitte wählen Sie die Länge aus");
                    return false;
                                }}
                               
                            return true;
                    }       
                       
            </script>

HIer das Formular:

HTML-Code:

<form name="Formular" method="post" class="product" action="index.php">
<span class="addtocart-button">
                                <input type="submit" name="addtocart"  class="addtocart-button" value="<?php echo $button_lbl ?>" title="<?php echo $button_lbl ?>" onmousedown="return checkForm( );" onmouseover="return checkForm1( );" onmouseout="return checkForm2( );" />
                        </span>
</form>

<img id="image" class="waehlen" src="/waehlen.png" alt="" style="display:none;" >

Seitenquellcode:

HTML-Code:

<form class="product" action="index.php" method="post" name="Formular">
<div class="product-fields">
<div class="product-field-type-V" style="display:inline-block;">
<span class="product-fields-title">Größe/Länge</span>
<span class="product-field-display">
<select id="customPrice06" name="customPrice[0][6]">
<option value="custom_value">Bitte wählen</option>
<option value="32869">36/34 </option>
<option value="32867">38/30 </option>
...

Ich habe das Ganze auch auf der Produktseite laufen, da funktioniert ist. Sobald beim Dropdown "Bitte wählen" in den Warenkorb gelegt werden soll, gibt es eine Meldung, das über mouseover und down.
Verstehe nicht, warum das auf dem Wunschzettel nicht funktioniert.
Fehlermeldung im Chrome: Uncaught ReferenceError: checkForm1 is not defined

Jemand eine Idee?


Alle Zeitangaben in WEZ +2. Es ist jetzt 10:57:50 Uhr.

Powered by vBulletin® Version 3.8.3 (Deutsch)
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.