10-16-2007 9:06 PM
Hi everyone,
Does anyone have knowledge of how to pass a URL parameter to a javascript block? For example, I have a URL parameter called "Machine" in the URL below:
http://xmiidevvs/Illuminator/xmiitest/Hamel.irpt?Machine=1
When I try to reference this parameters value in the javascript code, the results are a blank screen (errors out).
Please see my javascript below:
<!--
var Node
Node = {Machine}*2+9 //This does not Work!!!!!/////
document.write("<APPLET NAME='{Machine} Chart' CODEBASE='/Illuminator/Classes' CODE='iChart' ARCHIVE='illum8.zip' WIDTH='640' HEIGHT='400' MAYSCRIPT>")
document.write("<PARAM NAME='QueryTemplate' VALUE='iHistorian/Minutes/TurnMinutesTagname'>")
document.write("<PARAM NAME='DisplayTemplate' VALUE='iHistorian/Minutes/AllTurnMinutes'>")
document.write("<PARAM NAME='ChartType' VALUE='Bar'>")
document.write("<PARAM NAME='Title' VALUE='{Machine}'>")
document.write("<PARAM NAME='Tagname.1' VALUE='OPCSERVER.USBtoCAN.Node " + Node + ".AmberMinutes'>")
document.write("</APPLET>")
//-->
Thanks to all!
Mike
10-25-2007 3:05 PM
Hi Mike,
Here's a function to get the value of the 'Machine' url param.
function getMachine()
{
var m = window.location.search.match(/Machine=(w+)&?/);
return m[1];
}
So you can do:
var machine = getMachine();
Regards
Gregor
10-25-2007 3:05 PM
Hi Mike,
Here's a function to get the value of the 'Machine' url param.
function getMachine()
{
var m = window.location.search.match(/Machine=(w+)&?/);
return m[1];
}
So you can do:
var machine = getMachine();
Regards
Gregor