Or generate the target location in JSP like this: <script language="javascript"> var mytarget = <html:rewrite action="/PrepareSchedule.do"/> </script>
Then look up for target in your main Javascript function. I guess it would be easier to "attach" target to some well-know object like window, for example: window.mytarget = <html:rewrite action="/PrepareSchedule.do"/> I am not a Javascript pro, but you get the idea. On 4/13/06, Frank W. Zammetti <[EMAIL PROTECTED]> wrote: > The JS file is retrieved by the browser after the page loads and is not > processed on the server, so the <html:rewrite> tag will not be interpreted. > > Either leave the script in the JSP as you mentioned, or include it in the JSP > via server-side JSP include, or configure you web/app server to run .js files > through the JSP processor. > > Frank > > -----Original Message----- > From: "fea jabi" <[EMAIL PROTECTED]> > To: user@struts.apache.org > Sent: 4/13/06 9:14 AM > Subject: struts and javascript > > In a JS file I created a function as below. > > function showPopup(htmlRewrite) { > var w = 480, h = 340; > > if (document.all || document.layers) { > w = screen.availWidth; > h = screen.availHeight; > } > > var popW = 200, popH = 100; > var leftPos = (w-popW)/2, topPos = (h-popH)/2; > > window.open( 'htmlRewrite', "", "resizable, toolbar=yes, statusbar=yes, > menubar=yes, status=yes, location=yes, scrollbars=yes", 'width=' + popW + > ',height=' + popH + ',top=' + topPos + ',left=' + leftPos); > } > > But getting error at the select statement below. how to call the above > function?? > > <html:select name="Form1" property="typeselected" > onchange='showPopup("<html:rewrite action="/PrepareSchedule.do"/>");'> > <htmlptions collection="typeList" property="value" labelProperty="label"/> > </html:select> > > ********************************************************* > > Was working fine when I had the js function in the jsp itself. i.e it was > working fine with below code > > function showPopup() { > var w = 480, h = 340; > > if (document.all || document.layers) { > w = screen.availWidth; > h = screen.availHeight; > } > > var popW = 200, popH = 100; > var leftPos = (w-popW)/2, topPos = (h-popH)/2; > > window.open('<html:rewrite action="/PrepareSchedule.do"/>', "", "resizable, > toolbar=yes, statusbar=yes, menubar=yes, status=yes, location=yes, > scrollbars=yes", 'width=' + popW + ',height=' + popH + ',top=' + topPos + > ',left=' + leftPos); > } > </script> > > > > <html:select name="Form1" property="typeselected" onchange='showPopup();'> > <htmloptions collection="typeList" property="value" labelProperty="label"/> > </html:select> > > > But now trying to have a common function in the js file and pass an argument > for the url it has to go to. > > what's is the right way of doing this? > > Thanks. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]