[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XSL and Javascript to set new window parameters
The best way (or just an alternative) to handle window.open's is to put it in a function and call it from the click event. It has been my experience that you get inconsistent results calling window.open directly. so you could have a javascript function that is something like this (you may want to parametize more stuff): function gotoURL (thePage){ window.open(thePage,'new','toolbars=no,scrollbars=no') } then in your xsl/xml transform you would write out a line that looks like: <a href="javascript:gotoURL('default.html');">Home</a> note: you can call mutliple functions like this: <a href="javascript:gotoURL('default.html');loadVars();someOtherFunction();">Ho me</a> the XSL could look like this: <!-- &srv_uri; is an entity that defines the fully qualified root of the site --> <a href="javascript:gotoURL('&src_uri;/<xsl:value-of select="$theURLtoGoto"/>');"> <xsl:value-of select="$linkText"/> </a> (probably should be all one line...I separated to make it a little more clear...) By the way, you can put all of your javascript functions in a separate file and include it (client-side) so you don't have to go through all the CDATA or escaping of your functions for the XSL transfomation. You can do something like this: // &js_uri; is an entity that defines the path to the Javascript files <script language="JavaScript" src="&js_uri;/scripts.js"></script> > > I have an XSL sheet that constructs a simple table with links created from a > > set of ID's taken from the XML. > > Creating the link is straighforward but I want to ensure that the link is > > opened in a new window with specific parameters. I know how to do this in > > Javascript using the code > > > > onClick="window.open('default.html','new','toolbars=no,scrollbars=no') XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|