In a JS file I created a function as below.
function showPopup(var 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”/>”);’>
<html:options 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();’>
<html:options 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 wrong with the above code? how to pass an agument?
Thanks.