Foros del Web » Programando para Internet » Javascript »

Recoger variables con JS

Estas en el tema de Recoger variables con JS en el foro de Javascript en Foros del Web. Hola, no se mucho de js y quisiera que me hechen una mano: Tengo este código para recoger variables con javascript pero el asunto es ...
  #1 (permalink)  
Antiguo 15/08/2005, 15:24
 
Fecha de Ingreso: enero-2005
Mensajes: 6
Antigüedad: 19 años, 7 meses
Puntos: 0
Recoger variables con JS

Hola, no se mucho de js y quisiera que me hechen una mano:
Tengo este código para recoger variables con javascript pero el asunto es que en otros navegadores que no sean internet explorer no me funciona.
El problema es que tengo que recoger las variables y agregarle al flash, pero eso digo en ie me funciona pero en otro navegador no
Gracias de antemano.
Código:
<script>
function PageQuery(q) {
if(q.length > 1) this.q = q.substring(1, q.length);
else this.q = null;
this.keyValuePairs = new Array();
if(q) {
for(var i=0; i < this.q.split("&").length; i++) {
this.keyValuePairs[i] = this.q.split("&")[i];
}
}
this.getKeyValuePairs = function() { return this.keyValuePairs; }
this.getValue = function(s) {
for(var j=0; j < this.keyValuePairs.length; j++) {
if(this.keyValuePairs[j].split("=")[0] == s)
return this.keyValuePairs[j].split("=")[1];
}
return false;
}
this.getParameters = function() {
var a = new Array(this.getLength());
for(var j=0; j < this.keyValuePairs.length; j++) {
a[j] = this.keyValuePairs[j].split("=")[0];
}
return a;
}
this.getLength = function() { return this.keyValuePairs.length; } 
}
function queryString(key){
var page = new PageQuery(window.location.search); 
return unescape(page.getValue(key)); 
}
function displayItem(key){
if(queryString(key)=='false') 
{
<!-- document.write("you didn't enter a ?mi_var=value querystring item."); -->
}else{
document.write(queryString(key));
}
}
</script>
Código:
<SCRIPT LANGUAGE=JavaScript1.1>
	<!--
	var MM_contentVersion = 6;
	var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
	if ( plugin ) {
			var words = navigator.plugins["Shockwave Flash"].description.split(" ");
			for (var i = 0; i < words.length; ++i)
			{
			if (isNaN(parseInt(words[i])))
			continue;
			var MM_PluginVersion = words[i]; 
			}
		var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
	}
	else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 
	   && (navigator.appVersion.indexOf("Win") != -1)) {
		document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
		document.write('on error resume next \n');
		document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
		document.write('</SCR' + 'IPT\> \n');
	}
	if ( MM_FlashCanPlay ) {
		document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="100%" HEIGHT="100%" id="Menu" ALIGN="">');
		document.write('<PARAM NAME=movie VALUE="menu.swf">');
//		document.write('<param name="FlashVars" value="mi_var=' + displayItem('mi_var') + '">');
		document.write('<param name="FlashVars" value="mi_var=');
		document.write(displayItem('mi_var'));//Aquí se agrega la variable pero en el flash no me reconoce
		document.write('">');
		document.write('<param name="quality" value="high">');
		document.write('<param name="menu" value="false">');
		document.write('<PARAM NAME=scale VALUE=exactfit>');
		document.write('<param name=wmode value=opaque>');
		document.write('<PARAM NAME=bgcolor VALUE=#FFFFFF>');
		document.write('<embed src="menu.swf"  WIDTH="100%" HEIGHT="100%" ALIGN="" menu=false wmode=opaque quality=high scale=exactfit bgcolor=#FFFFFF NAME="Menu" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" flashvars="mi_var="> </EMBED>');
		document.write('</object>');
	} else{
		document.write('no tiene instalado flash');
	}
	//-->
</SCRIPT>
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 13:17.