2 scripte -> local gehts - online nicht

resterampe

Mitglied
script1:
ein einheiten umrechner:
http://www.julianbrinke.de/?act=tools
http://www.julianbrinke.de/privat/pages/tools/konverter.php

HTML:
  <script type="text/javascript">
  // Temperatur
  function CtoF(C) {
  	S = (1.8 * C) + 32;
  	S = S * 10;
  	S = Math.round(S);
  	return(S / 10);
  	}
  function FtoC(F) {
  	S = (F - 32) / 1.8;
  	S = S * 10;
  	S = Math.round(S);
  	return(S / 10);
  	}
  
  // andere
  function Convert(E, T1, T2) {
  	S = E / T1;
  	S = S * T2;
  	S = S * 10000000;
  	S = Math.round(S);
  	return(S / 10000000);
  	}
  
  </script>
  <script type="text/javascript">
  // Typen: 
  //		1 Längen
  // 		2 Gewichte
  // 		3 Volumen
  
  	var Taux = new Array();
  	var TypeMesure = new Array();
  	var t = new String();
  
  	TypeMesure[0]=2;
  	Taux[0]=1;
  	t += '<option value="0">Gramm</option>';
  
  	TypeMesure[1]=2;
  	Taux[1]=15.43;
  	t += '<option value="1">Grain</option>';
  
  	TypeMesure[2]=2;
  	Taux[2]=0.564;
  	t += '<option value="2">Dram</option>';
  
  	TypeMesure[3]=2;
  	Taux[3]=0.03527;
  	t += '<option value="3">Ounce</option>';
  
  	TypeMesure[4]=1;
  	Taux[4]=1;
  	t += '<option value="4">Meter</option>';
  
  	TypeMesure[5]=1;
  	Taux[5]=39;
  	t += '<option value="5">Inch</option>';
  
  </script>
  
  <h3>Massen Umrechner</h3>
  <form method="post" action="">
  	<p><label>von:</label>
 	<input name="ValueMassGauche" size="10" onkeyup="ValueMassDroite.value = Convert(ValueMassGauche.value, MassDroite.value, MassGauche.value);" type="text" class="inputtext" />
 	<select name="MassGauche" onchange="ValueMassDroite.value = Convert(ValueMassGauche.value, MassDroite.value, MassGauche.value);" class="inputtext">
  		<option value="0.001">Milligram</option>
  		<option value="1">Gram (g)</option>
  		<option value="1000" selected="selected">Kilogram (kg)</option>
  		<option value="1000000">Metric Ton (t)</option>
  		<option value="0">---------------------------</option>
  		<option value="28.3495231">Ounce (Oz)</option>
  		<option value="453.59237">Pound (lb)</option>
  		<option value="1016000">Long Ton (lt)</option>
  		<option value="907000">Short Ton (st)</option>
  	</select></p>
  	<p><label>nach:</label>
 	<input name="ValueMassDroite" size="10" onkeyup="ValueMassGauche.value = Convert(ValueMassDroite.value, MassGauche.value, MassDroite.value);" type="text" class="inputtext" />
 	<select name="MassDroite" onchange="ValueMassGauche.value = Convert(ValueMassDroite.value, MassGauche.value, MassDroite.value);" class="inputtext">
  		<option value="0.001">Milligram</option>
  		<option value="1">Gram (g)</option>
  		<option value="1000" selected="selected">Kilogram (kg)</option>
  		<option value="1000000">Metric Ton (t)</option>
  		<option value="0">---------------------------</option>
  		<option value="28.3495231">Ounce (Oz)</option>
  		<option value="453.59237">Pound (lb)</option>
  		<option value="1016000">Long Ton (lt)</option>
  		<option value="907000">Short Ton (st)</option>
  	</select></p>
  </form>
  
  <h3>L&auml;ngen Umrechner </h3>
  <form method="post" action="">
  <p><label>von:</label>
 	<input name="ValueLengthGauche" size="10" onkeyup="ValueLengthDroite.value = Convert(ValueLengthGauche.value, LengthDroite.value, LengthGauche.value);" type="text" class="inputtext" />
 	<select name="LengthGauche" onchange="ValueLengthDroite.value = Convert(ValueLengthGauche.value, LengthDroite.value, LengthGauche.value);" class="inputtext">
  		<option value="0.001">Millimeter (mm)</option>
  		<option value="0.01">Centimeter (cm)</option>
  		<option value="0.1">Decimeter (dm)</option>
  		<option value="1" selected="selected">Meter (m)</option>
  		<option value="1000">Kilometer (km)</option>
  		<option>---------------------------</option>
  		<option value="0.0254">Inch (in)</option>
  		<option value="0.9144">Yard (yd)</option>
  		<option value="0.3048">Foot (ft)</option>
  		<option value="1609.3">Mile (mi)</option>
  	</select></p>
  	<p><label>nach:</label>
 	<input name="ValueLengthDroite" size="10" onkeyup="ValueLengthGauche.value = Convert(ValueLengthDroite.value, LengthGauche.value, LengthDroite.value);" type="text" class="inputtext" />
 	<select name="LengthDroite" onchange="ValueLengthGauche.value = Convert(ValueLengthDroite.value, LengthGauche.value, LengthDroite.value);" class="inputtext">
  		<option value="0.001">Millimeter (mm)</option>
  		<option value="0.01">Centimeter (cm)</option>
  		<option value="0.1">Decimeter (dm)</option>
  		<option value="1" selected="selected">Meter (m)</option>
  		<option value="1000">Kilometer (km)</option>
  		<option>---------------------------</option>
  		<option value="0.0254">Inch (in)</option>
  		<option value="0.9144">Yard (yd)</option>
  		<option value="0.3048">Foot (ft)</option>
  		<option value="1609.3">Mile (mi)</option>
  	</select></p>
  </form>
  
  <h3>Fl&auml;chen Umrechner </h3>
  <form method="post" action="">
  	<p><label>von:</label>
 	<input name="ValueAreaGauche" size="10" onkeyup="ValueAreaDroite.value = Convert(ValueAreaGauche.value, AreaDroite.value, AreaGauche.value);" type="text" class="inputtext" />
 	<select name="AreaGauche" onchange="ValueAreaDroite.value = Convert(ValueAreaGauche.value, AreaDroite.value, AreaGauche.value);" class="inputtext">
  		<option value="10000">Hectare (ha)</option>
  		<option value="1" selected="selected">Square meter (m2)</option>
  		<option value="1000000">Square kilometer (km2)</option>
  		<option>---------------------------</option>
  		<option value="4046.9">Acre (acr)</option>
  		<option value="0.0929">Square foot (ft2)</option>
  		<option value="0.8361">Square yard (yd2)</option>
  		<option value="2590000">Square mile (mi2)</option>
  	</select></p>
  	<p><label>nach:</label>
 	<input name="ValueAreaDroite" size="10" onkeyup="ValueAreaGauche.value = Convert(ValueAreaDroite.value, AreaGauche.value, AreaDroite.value);" type="text" class="inputtext" />
 	<select name="AreaDroite" onchange="ValueAreaGauche.value = Convert(ValueAreaDroite.value, AreaGauche.value, AreaDroite.value);" class="inputtext">
  		<option value="10000">Hectare (ha)</option>
  		<option value="1" selected="selected">Square meter (m2)</option>
  		<option value="1000000">Square kilometer (km2)</option>
  		<option>---------------------------</option>
  		<option value="4046.9">Acre (acr)</option>
  		<option value="0.0929">Square foot (ft2)</option>
  		<option value="0.8361">Square yard (yd2)</option>
  		<option value="2590000">Square mile (mi2)</option>
  	</select></p>
  </form>
  
  <h3>Volumen Umrechner</h3>
  <form method="post" action="">
  	<p><label>von:</label>
 	<input name="ValueVolumeGauche" size="10" onkeyup="ValueVolumeDroite.value = Convert(ValueVolumeGauche.value, VolumeDroite.value, VolumeGauche.value);" type="text" class="inputtext" />
 	<select name="VolumeGauche" onchange="ValueVolumeDroite.value = Convert(ValueVolumeGauche.value, VolumeDroite.value, VolumeGauche.value);" class="inputtext">
  		<option value="1" selected="selected">Liter (l)</option>
  		<option value="100">Hectoliter (hl)</option>
  		<option value="0.001">Cubic centimeter (cm3)</option>
  		<option value="1000">Cubic meter (m3)</option>
  		<option value="0">---------------------------</option>
  		<option value="0.016387">Cubic inch (in3)</option>
  		<option value="28.3">Cubic foot (ft3)</option>
  		<option value="0.028416">UK Fluid ounce (foz)</option>
  		<option value="0.029574">US Fluid ounce (foz)</option>
  		<option value="4.5461">UK Gallon (gal)</option>
  		<option value="3.7854">US Gallon (gal)</option>
  		<option value="0.5683">UK Pint (pt)</option>
  		<option value="0.4731">US pint (pt)</option>
  	</select></p>
  	<p><label>nach:</label>
 	<input name="ValueVolumeDroite" size="10" onkeyup="ValueVolumeGauche.value = Convert(ValueVolumeDroite.value, VolumeGauche.value, VolumeDroite.value);" type="text" class="inputtext" />
 	<select name="VolumeDroite" onchange="ValueVolumeGauche.value = Convert(ValueVolumeDroite.value, VolumeGauche.value, VolumeDroite.value);" class="inputtext">
  		<option value="1" selected="selected">Liter (l)</option>
  		<option value="100">Hectoliter (hl)</option>
  		<option value="0.001">Cubic centimeter (cm3)</option>
  		<option value="1000">Cubic meter (m3)</option>
  		<option value="0">---------------------------</option>
  		<option value="0.016387">Cubic inch (in3)</option>
  		<option value="28.3">Cubic foot (ft3)</option>
  		<option value="0.028416">UK Fluid ounce (foz)</option>
  		<option value="0.029574">US Fluid ounce (foz)</option>
  		<option value="4.5461">UK Gallon (gal)</option>
  		<option value="3.7854">US Gallon (gal)</option>
  		<option value="0.5683">UK Pint (pt)</option>
  		<option value="0.4731">US pint (pt)</option>
  	</select></p>
  </form>
  
  <h3>Temperatur Umrechner
  </h3>
  <form method="post" action="">
  <p><input name="TempC" size="10" onkeyup="TempF.value = CtoF(this.value);" type="text" class="inputtext" />
  ° C (Celsius)</p>
  <p><input name="TempF" size="10" onkeyup="TempC.value = FtoC(this.value);" type="text" class="inputtext" />
  ° F (Fahrenheit)</p>
  </form>

funktioniert wenn ich die Seite aufrufe sowohl im IE als auch im FF.
wenn ich es m Design aufrufe, geht es nciht mehr.

script2:
ein Buchstabier tool:
http://www.julianbrinke.de/?act=tools
http://www.julianbrinke.de/privat/pages/tools/spell.php

HTML:
  <script type="text/javascript" src="script/alphabets.js"></script>
  <script type="text/javascript">
  
  function Convert(word) {
  	  var spellint = "", spelluk = "", spellny= "", spellde="", letter = "";
  	for (i=0;i<word.length;i++){
  		letter = word.charAt(i).toUpperCase();
  		if (letter == " ") {
  			spellint += letter + "<br />";
  			spelluk += letter + "<br />";
  			spellny += letter + "<br />";
  			spellde += letter + "<br />";
  			} 
  		else {
  			if (alph_int[letter])
 				spellint += alph_int[letter] + "<br />";
  			else
 				spellint += letter + "<br />";
 			if (alph_uk[letter])		
 				spelluk += alph_uk[letter] + "<br />";
  			else	
 				spelluk += letter + "<br />";
 			if (alph_nypd[letter])		
 				spellny += alph_nypd[letter] + "<br />";
  			else 
 				spellny += letter + "<br>";
  			if (alph_de[letter])
 				spellde += alph_de[letter] + "<br />";
  			else
 				spellde += letter + "<br />";
  	
  		} 
  	}
  	pint.innerHTML=spellint;
  	puk.innerHTML=spelluk;
  	pny.innerHTML=spellny;
  	pde.innerHTML=spellde;
  }
  
  </script>
  <form method="post" action="">
 <p><label>Bitte geben Sie das zu buchstabierende Wort ein.</label><input name="wordtospell" size="80" onkeyup="Convert(wordtospell.value);" type="text" class="inputtext" /></p>
  <table>
  	<tr> 
 		<td class="textbody" width="25%"><strong>International</strong></td>
 		<td class="textbody" width="25%"><strong>British</strong></td>
 		<td class="textbody" width="25%"><strong>New York Police</strong></td>
 		<td class="textbody" width="25%"><strong>German </strong></td>
  	</tr>
  	<tr>
  		<td class="textbody"><p id="pint"></p></td>
  		<td class="textbody"><p id="puk"></p></td>
  		<td class="textbody"><p id="pny"></p></td>
  		<td class="textbody"><p id="pde"></p></td>
  	</tr>
  </table>
  </form>

funktioniert logischerweise nur im design da sonst der bezug falsch ist.
da leider auch nur im IE.


Wenn jemand ne Idee hat wäre ich dankbar.
Julian
 
Hi,

zunächst rufst du innerhalb des Dokumentes zwei verschiedene Funktionen mit identischem Namen
(Convert) auf. Am besten änderst du den Funktionsnamen der Buchstabier-Funktion (z.B. in Convert_).

Der Buchstabierer funktioniert nur im IE, weil die Elemente (pint, puk, pny, pde) über die JS-Methode
getElementById angesprochen werden sollten.

Der entsprechende Bereich könnte folgendermassen aussehen:
HTML:
<script type="text/javascript">
<!--
	function Convert_(word) {
	    var spellint = "", spelluk = "", spellny= "", spellde="", letter = "";
	  for (i=0;i<word.length;i++){
	    letter = word.charAt(i).toUpperCase();
	    if (letter == " ") {
	      spellint += letter + "<br />";
	      spelluk += letter + "<br />";
	      spellny += letter + "<br />";
	      spellde += letter + "<br />";
	      }
	    else {
	      if (alph_int[letter])
	        spellint += alph_int[letter] + "<br />";
	      else
	        spellint += letter + "<br />";
	      if (alph_uk[letter])
	        spelluk += alph_uk[letter] + "<br />";
	      else
	        spelluk += letter + "<br />";
	      if (alph_nypd[letter])
	        spellny += alph_nypd[letter] + "<br />";
	      else
	        spellny += letter + "<br>";
	      if (alph_de[letter])
	        spellde += alph_de[letter] + "<br />";
	      else
	        spellde += letter + "<br />";

	    }
	  }
          // Ausgabeelemente über getElementByID ansprechen
	  document.getElementById("pint").innerHTML=spellint;
	  document.getElementById("puk").innerHTML=spelluk;
	  document.getElementById("pny").innerHTML=spellny;
	  document.getElementById("pde").innerHTML=spellde;
	}
//-->
</script>
<form method="post" action="">
<p><label>Bitte geben Sie das zu buchstabierende Wort ein.</label><input name="wordtospell" size="80" onkeyup="Convert_(this.form.wordtospell.value);" type="text" class="inputtext" /></p>
<table>
	<tr>
		<td class="textbody" width="25%"><strong>International</strong></td>

		<td class="textbody" width="25%"><strong>British</strong></td>
		<td class="textbody" width="25%"><strong>New York Police</strong></td>
		<td class="textbody" width="25%"><strong>German </strong></td>
	</tr>
	<tr>
		<td class="textbody"><p id="pint"></p></td>
		<td class="textbody"><p id="puk"></p></td>

		<td class="textbody"><p id="pny"></p></td>
		<td class="textbody"><p id="pde"></p></td>
	</tr>
</table>
</form>
Ciao
Quaese
 

Neue Beiträge

Zurück