Results 1 to 4 of 4

Thread: Trouble passing in variable for value of left & top on dhtmlmodal.open

  1. #1
    Join Date
    Feb 2006
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Trouble passing in variable for value of left & top on dhtmlmodal.open

    1) Script Title: DHTML Modal window v1.1

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...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

  2. #2
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    I'm not wonderful with JavaScript but don't you need to pass on the variables like this somehow?
    Code:
    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")
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  3. #3
    Join Date
    Feb 2006
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Apparently you are wonderful with Javascript, because that fixed it! Thank you!

  4. #4
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    Fantastic! The Christmas break has done my brain some good
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

Similar Threads

  1. Passing Variable
    By kathycam in forum JavaScript
    Replies: 2
    Last Post: 06-14-2012, 12:06 AM
  2. Passing variable to PHP in JS
    By hemi519 in forum JavaScript
    Replies: 3
    Last Post: 05-27-2012, 12:43 PM
  3. passing a parameter with the value of a variable
    By dariuc in forum JavaScript
    Replies: 2
    Last Post: 09-16-2009, 01:45 AM
  4. Trouble passing variables to another function
    By polyglot in forum JavaScript
    Replies: 10
    Last Post: 06-05-2009, 02:17 PM
  5. Resolved Help with variable passing
    By cr3ative in forum JavaScript
    Replies: 4
    Last Post: 12-13-2008, 06:30 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •