You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by fea jabi <zy...@hotmail.com> on 2006/04/13 15:14:17 UTC

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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org