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.

_________________________________________________________________
Is your PC infected? Get a FREE online computer virus scan from McAfee 
Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to