Log in

View Full Version : Trouble passing in variable for value of left & top on dhtmlmodal.open



JeffSinNHUSA
12-26-2013, 01:34 PM
1) Script Title: DHTML Modal window v1.1

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/dhtmlmodal.htm

3) Describe problem:

If I change the dhtmlmodal.open script to hard code the left and top positions, everything works fine. If I pass in a variable for those values, it doesn't work. Am I doing something wrong?

Works:

var agreewin = dhtmlmodal.open("agreebox", "iframe", "agreement.htm", "This Page's Terms of service", "width=590px,height=450px,left=647,top=84,center=0,resize=1,scrolling=0", "recal")

Doesn't work:

var xpos = 647;
var ypos = 84;

var agreewin = dhtmlmodal.open("agreebox", "iframe", "agreement.htm", "This Page's Terms of service", "width=590px,height=450px,left=xpos,top=ypos,center=0,resize=1,scrolling=0", "recal")


Example:
www.wegoplaces.com/demo-modal.htm

Thanks for your help!

Jeff

Beverleyh
12-26-2013, 02:03 PM
I'm not wonderful with JavaScript but don't you need to pass on the variables like this somehow?

var agreewin = dhtmlmodal.open("agreebox", "iframe", "agreement.htm", "This Page's Terms of service", "width=590px,height=450px,left="+xpos+",top="+ypos+",center=0,resize=1,scrolling=0", "recal")

JeffSinNHUSA
12-26-2013, 02:51 PM
Apparently you are wonderful with Javascript, because that fixed it! Thank you!

Beverleyh
12-26-2013, 05:24 PM
Fantastic! The Christmas break has done my brain some good :D