SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist WebMachine's Avatar
    Join Date
    Jun 2007
    Location
    Ontario, Canada
    Posts
    430
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    newbie needs new windows

    My client has permission to use the online financial calculators of one of the insurance companies that supplies his company. I have linked to the calculators, and am now trying to use javascript to have each calculator appear in a pre-sized new window, without leaving the client's website. I used the following code for each link (things have been left generic to protect the anonymous):
    HTML Code:
    <p><a onClick="window.open('http://www.URL.com/calculator.jsp', 'name', 'height=305,width=605')" 
    href="http://www.URL.com/calculator.jsp">RRSP Calculator</a>
    - Start planning now so you can retire with peace of mind.</p>
    1. I know I have the URL twice - once in the javascript and once just in the link, but if I take out the second URL, my link disappears. With both there, I get my calculator in a new window just like I want it, but then it also opens in the other company's website (leaving my client's website). So there I have the calculator twice, once in a large window and once in a small one.

    2. My second problem is that the small new window only shows up for the first calculator link, not the others (there are about eight) even though my javascript code is the same except for the URL.

    3. My third problem is that I can't seem to get the small window to resize when I change the height and width in the code.

    Could someone please take a look at what I have and tell me what went wrong? (I know next to nothing about Javascript and am struggling with how to fix this.)

  2. #2
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    As for your first problem, return false to stop the link from going through:
    Code html:
    <p><a onClick="window.open('http://www.URL.com/calculator.jsp', 'name', 'height=305,width=605'); return false;" 
    href="http://www.URL.com/calculator.jsp">RRSP Calculator</a>
    - Start planning now so you can retire with peace of mind.</p>
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  3. #3
    SitePoint Evangelist WebMachine's Avatar
    Join Date
    Jun 2007
    Location
    Ontario, Canada
    Posts
    430
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the suggestion. I tried it, and it stopped the calculator from opening in a new window, but kept the link going through to the other website. I wanted it the other way around.


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
  •