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>