Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

javascript funtion(x,x)

Empfohlene Antworten

Veröffentlicht

Hallo ;)

ich habe folgede JavaScript-Funktion, die abprüfen soll, ob 2 Strings mit einem Wert belegt sind :


function Text(name,message) 

{

	if (name == "")

	{

		alert('Es wurde kein Name eingegeben!');

	}


	if (message = "")

	{

		alert('Es wurde keine Message eingegeben!');		

	}

}

Hier ist der Aufruf der Funktion:

<input type="submit" value="Eintragen" onclick="Text(document.werte.name.value,document.werte.message.value)">

Der Aufruf ist in einem Forular wo ein feld "name" und das andere "message" heißt.

Mein Problem ist, dass "message" nicht mit an die Funktion übergeben wird!

also muss beim Aufruf ja irgend etwas falsch sein :( .

danke für die baldige hilfe :)

Jake

so sieht bei mir aus .... passt eigendlich alles


<input type="text" name="name" value="">

<textarea cols="30" rows="10" name="message"></textarea>

1. Lass dir mal den Inhalt von message ausgeben

2. Probier das Ganze mal mit einem normalen Button anstelle von submit

3. Komm bitte weg vom Microsoft - all - Objekt

Beispiel mit DOM (funzt)


<script type="text/javascript">

<!--

function zeige() {

	alert(document.forms[0].elements[0].value);

	alert(document.forms[0].elements[1].value);

}

-->

</script>



<body>

<form >

  <input name="text" type="text" value="Hallo"/>

  <textarea name="textarea">Auch hallo</textarea>

  <input type="button" name="Submit" value="Abschicken" onClick="zeige()"/>

</form>

</body>

Habs gefunde :) .... LOL bin ich doof *gg*

so musses:

if (message == "")

...

so war es:
if (message = "")

...

danke für help :P

mfg Jake

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.