/    Sign up×
Community /Pin to ProfileBookmark

js function argument passing probs

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.

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@KorApr 12.2006 — function showPopup(htmlRewrite)
Copy linkTweet thisAlerts:
@RxyzauthorApr 12.2006 — Thanks for responding.

the error is here

<html:select name="Form1" property="typeselected" onchange='showPopup("<html:rewrite action="/PrepareSchedule.do"/>");'>

<htmlptions collection="typeList" property="value" labelProperty="label"/>

</html:select>

not sure what it is?
×

Success!

Help @Rxyz spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...