Seite 1 von 1

JavaScript in Joomla!-Problem

Verfasst: 23.12.2007, 22:32
von Sir TSCH
Hallo ich habe ein Problem mit JavaScript auf joomla!:

Bei folgendem Code kann man eine Währung auslesen,
bei den unten folgenden 3 Angeboten wird dann die gewählt Währung mit entsprechendem Betrag eingefügt.
Eines der drei Angebote kann man dann auswählen und per Paypal bezahlen.

Auf einer Testseite lief das alles unter IE und Firefox.

Nun in einer Joomla!-Seite geht das nur noch teilweise:
Unter IE7 und Firefox wird die gewählte Währung in den drei Angeboten nicht mehr automatisch ersetzt.
Der Rest geht!
Mit IE6 geht es auch.

Hat jemand eine Ahnung, an was das liegen könnte?

Für Hilfe wäre ich sehr dankbar...


Code: Alles auswählen

<SCRIPT type="text/JavaScript">
<!--
/* Währung und Preis austauschen */
function change_currency&#40;currency&#41;
&#123;	
	if &#40;currency == "EUR"&#41;
	&#123;
		document.all.comfort3.innerHTML = "EUR 30.-";
		document.all.comfort10.innerHTML = "EUR 60.-";
		document.all.comfort20.innerHTML = "EUR 120.-";
	&#125;
	else if &#40;currency == "CHF"&#41;
	&#123;
		document.all.comfort3.innerHTML = "CHF 50.-";
		document.all.comfort10.innerHTML = "CHF 120.-";
		document.all.comfort20.innerHTML = "CHF 220.-";
	&#125;
	else if &#40;currency == "USD"&#41;
	&#123;
		document.all.comfort3.innerHTML = "USD 40.-";
		document.all.comfort10.innerHTML = "USD 100.-";
		document.all.comfort20.innerHTML = "USD 200.-";
	&#125;
&#125;
/* Vor dem Senden Eingaben überprüfen und Daten ins Paypal-Formular einfüllen */
function send&#40;&#41;
&#123;
	var vCurrency = document.paypal.currency.selectedIndex;
	if &#40;document.paypal.agb.checked != true&#41;
	&#123;
		alert&#40;"Sie müssen die AGB's akzeptieren!"&#41;;
		return false;
	&#125;
	else 
	&#123;			
		if &#40;document.paypal.product&#91;0&#93;.checked == true&#41;
		&#123;	
			document.paypal.item_name.value = "Comfort Package 3";
			if &#40;document.paypal.currency.selectedIndex == 0&#41; &#123;
				document.paypal.currency_code.value = "EUR";
				document.paypal.amount.value = "30.00";
			&#125;
			if &#40;document.paypal.currency.selectedIndex == 1&#41; &#123;
				document.paypal.currency_code.value = "CHF";
				document.paypal.amount.value = "50.00";
			&#125;
			if &#40;document.paypal.currency.selectedIndex == 2&#41; &#123;
				document.paypal.currency_code.value = "USD";
				document.paypal.amount.value = "40.00";
			&#125;
		&#125;
		else if &#40;document.paypal.product&#91;1&#93;.checked == true&#41;
		&#123;
			document.paypal.item_name.value = "Comfort Package 10";
			if &#40;document.paypal.currency.selectedIndex == 0&#41; &#123;
				document.paypal.currency_code.value = "EUR";
				document.paypal.amount.value = "60.00";
			&#125;
			if &#40;document.paypal.currency.selectedIndex == 1&#41; &#123;
				document.paypal.currency_code.value = "CHF";
				document.paypal.amount.value = "120.00";
			&#125;
			if &#40;document.paypal.currency.selectedIndex == 2&#41; &#123;
				document.paypal.currency_code.value = "USD";
				document.paypal.amount.value = "100.00";
			&#125;
		&#125;
		else if &#40;document.paypal.product&#91;2&#93;.checked == true&#41;
		&#123;
			document.paypal.item_name.value = "Comfort Package 20";
			if &#40;document.paypal.currency.selectedIndex == 0&#41; &#123;
				document.paypal.currency_code.value = "EUR";
				document.paypal.amount.value = "120.00";
			&#125;
			if &#40;document.paypal.currency.selectedIndex == 1&#41; &#123;
				document.paypal.currency_code.value = "CHF";
				document.paypal.amount.value = "220.00";
			&#125;
			if &#40;document.paypal.currency.selectedIndex == 2&#41; &#123;
				document.paypal.currency_code.value = "USD";
				document.paypal.amount.value = "200.00";
			&#125;
		&#125;
		return true;
	&#125;
&#125;
//-->
</SCRIPT>

<form name="paypal" action="https&#58;//www.paypal.com/cgi-bin/webscr" method="post" onsubmit="return send&#40;&#41;">
<span>Wahl der Währung&#58;</span> 
<select onchange="change_currency&#40;this.options&#91;this.selectedIndex&#93;.value&#41;;" name="currency">
<option value="EUR" selected>EURO</option>
<option value="CHF">Schweizer Franken</option>
<option value="USD">US-Dollar</option>
</select>
<br />
<br />
<input type="radio" name="product" id="product" value="3">Comfort 3 Package, Preis&#58;  <span id="comfort3">EUR 30.-</span><br />
<input type="radio" name="product" id="product" value="10">Comfort 10 Package, Preis&#58; <span id="comfort10">EUR 60.-</span><br />
<input type="radio" name="product" id="product" value="20">Comfort 20 Package, Preis&#58; <span id="comfort20">EUR 120.-</span> <br />
<br /><br />
<span>Ich akzeptiere die AGBs&#58; </span>
<input type="checkbox" name="agb" id="agb" value="ja">
<br /><br />
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="beispiel@beispiel.com">
<input type="hidden" name="item_name" value="">
<input type="hidden" name="amount" value="">
<input type="hidden" name="no_shipping" value="0">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="">
<input type="hidden" name="lc" value="CH">
<input type="hidden" name="bn" value="PP-BuyNowBF">
<input type="image" src="https&#58;//www.paypal.com/de_DE/i/btn/x-click-but01.gif" border="0" name="submit" alt="Zahlen Sie mit PayPal - schnell, kostenlos und sicher!">
<img alt="" border="0" src="https&#58;//www.paypal.com/de_DE/i/scr/pixel.gif" width="1" height="1">
</form>


Verfasst:
von

Verfasst: 27.12.2007, 22:18
von !TL
Hallo,
ich würd tippen das Script läuft nur im Quirks-Mode und nicht im Standards-Mode.

Torsten

Re: JavaScript in Joomla!-Problem

Verfasst: 27.12.2007, 22:23
von girly07
[quote="Sir TSCH"]Hallo ich habe ein Problem mit JavaScript auf joomla!:

Bei folgendem Code kann man eine Währung auslesen,
bei den unten folgenden 3 Angeboten wird dann die gewählt Währung mit entsprechendem Betrag eingefügt.
Eines der drei Angebote kann man dann auswählen und per Paypal bezahlen.

Auf einer Testseite lief das alles unter IE und Firefox.

Nun in einer Joomla!-Seite geht das nur noch teilweise:
Unter IE7 und Firefox wird die gewählte Währung in den drei Angeboten nicht mehr automatisch ersetzt.
Der Rest geht!
Mit IE6 geht es auch.

Hat jemand eine Ahnung, an was das liegen könnte?

Für Hilfe wäre ich sehr dankbar...



[code]
<SCRIPT type="text/JavaScript">
<!--
/* Währung und Preis austauschen */
function change_currency(currency)
{
if (currency == "EUR")
{
document.all.comfort3.innerHTML = "EUR 30.-";
document.all.comfort10.innerHTML = "EUR 60.-";
document.all.comfort20.innerHTML = "EUR 120.-";
}
else if (currency == "CHF")
{
document.all.comfort3.innerHTML = "CHF 50.-";
document.all.comfort10.innerHTML = "CHF 120.-";
document.all.comfort20.innerHTML = "CHF 220.-";
}
else if (currency == "USD")
{
document.all.comfort3.innerHTML = "USD 40.-";
document.all.comfort10.innerHTML = "USD 100.-";
document.all.comfort20.innerHTML = "USD 200.-";
}
}
/* Vor dem Senden Eingaben überprüfen und Daten ins Paypal-Formular einfüllen */
function send()
{
var vCurrency = document.paypal.currency.selectedIndex;
if (document.paypal.agb.checked != true)
{
alert("Sie müssen die AGB's akzeptieren!");
return false;
}
else
{
if (document.paypal.product[0].checked == true)
{
document.paypal.item_name.value = "Comfort Package 3";
if (document.paypal.currency.selectedIndex == 0) {
document.paypal.currency_code.value = "EUR";
document.paypal.amount.value = "30.00";
}
if (document.paypal.currency.selectedIndex == 1) {
document.paypal.currency_code.value = "CHF";
document.paypal.amount.value = "50.00";
}
if (document.paypal.currency.selectedIndex == 2) {
document.paypal.currency_code.value = "USD";
document.paypal.amount.value = "40.00";
}
}
else if (document.paypal.product[1].checked == true)
{
document.paypal.item_name.value = "Comfort Package 10";
if (document.paypal.currency.selectedIndex == 0) {
document.paypal.currency_code.value = "EUR";
document.paypal.amount.value = "60.00";
}
if (document.paypal.currency.selectedIndex == 1) {
document.paypal.currency_code.value = "CHF";
document.paypal.amount.value = "120.00";
}
if (document.paypal.currency.selectedIndex == 2) {
document.paypal.currency_code.value = "USD";
document.paypal.amount.value = "100.00";
}
}
else if (document.paypal.product[2].checked == true)
{
document.paypal.item_name.value = "Comfort Package 20";
if (document.paypal.currency.selectedIndex == 0) {
document.paypal.currency_code.value = "EUR";
document.paypal.amount.value = "120.00";
}
if (document.paypal.currency.selectedIndex == 1) {
document.paypal.currency_code.value = "CHF";
document.paypal.amount.value = "220.00";
}
if (document.paypal.currency.selectedIndex == 2) {
document.paypal.currency_code.value = "USD";
document.paypal.amount.value = "200.00";
}
}
return true;
}
}
//-->
</SCRIPT>

<form name="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post" onsubmit="return send()">
<span>Wahl der Währung:</span>
<select onchange="change_currency(this.options[this.selectedIndex].value);" name="currency">
<option value="EUR" selected>EURO</option>
<option value="CHF">Schweizer Franken</option>
<option value="USD">US-Dollar</option>
</select>
<br />
<br />
<input type="radio" name="product" id="product" value="3">Comfort 3 Package, Preis: <span id="comfort3">EUR 30.-</span><br />
<input type="radio" name="product" id="product" value="10">Comfort 10 Package, Preis: <span id="comfort10">EUR 60.-</span><br />
<input type="radio" name="product" id="product" value="20">Comfort 20 Package, Preis: <span id="comfort20">EUR 120.-</span> <br />
<br /><br />
<span>Ich akzeptiere die AGBs: </span>
<input type="checkbox" name="agb" id="agb" value="ja">
<br /><br />
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="beispiel@beispiel.com">
<input type="hidden" name="item_name" value="">
<input type="hidden" name="amount" value="">
<input type="hidden" name="no_shipping" value="0">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="">
<input type="hidden" name="lc" value="CH">
<input type="hidden" name="bn" value="PP-BuyNowBF">
<input type="image" src="https://www.paypal.com/de_DE/i/btn/x-click-but01.gif" border="0" name="submit" alt="Zahlen Sie mit PayPal - schnell, kostenlos und sicher!">
<img alt="" border="0" src="https://www.paypal.com/de_DE/i/scr/pixel.gif" width="1" height="1">
</form>

[/code][/quote]






VON GIRLY07:ich glaub mal son virus! oder pc problem!

Verfasst: 28.12.2007, 07:00
von redbull_kevin
Hallo...

Schalte mal in der "Global Configuration" den "Default WYSIWYG Editor" auf "No WYSIWYG Editor" und gib den Code deines Scripts noch einmal ein und speichere die Seite dann. Ich hatte ebenfalls Probleme mit Scripts als ich noch einen WYSIWYG Editor verwendet habe.

Verfasst: 28.12.2007, 08:24
von Sir TSCH
Ich danke euch und werde mir eure Ideen mal genau anschauen...