Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-07-2010, 03:29 PM   PM User | #1
dm00n
New to the CF scene

 
Join Date: Oct 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
dm00n is an unknown quantity at this point
Passing Querystring to XSL param

Hey folks,

I have this hacked together code from some webpage that works in some versions of IE (but not the latest) and does not work in Firefox, etc.

I have seen examples of how to make stuff like this cross-browser, but usually the script is doing something different than I am doing, and I don't know enough about Javascript to adapt it.

Any help?

Another (but less pressing) issue is setting the value to ZZZ if there is no query string. It works if I do an if/else statement on this line:

Code:
processor.addParameter("param1", qrystring);
But only if it has a query string with no value (?Code=), not if there is nothing at all.

Code:
<script type="text/javascript">
urlstring = location.href;
qrystring=urlstring.substring(urlstring.indexOf("=") + 1, urlstring.length);

//Passing  XSL variable 
var xml = new ActiveXObject("MSXML2.DomDocument.4.0");
xml.async = false;
xml.load("ReportsForWeb.xml");

var xsl = new ActiveXObject("MSXML2.FreeThreadedDomDocument.4.0");
xsl.async = false;
xsl.load("program.xsl");

var template = new ActiveXObject("MSXML2.XSLTemplate.4.0")

template.stylesheet = xsl; 
processor = template.createProcessor();

processor.input = xml;
processor.addParameter("param1", qrystring);

processor.transform();
document.open();
document.write(processor.output);
document.close();

</script>

Last edited by dm00n; 10-07-2010 at 03:38 PM..
dm00n is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:31 PM.


Advertisement
Log in to turn off these ads.