Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Help with pop-up window
Old 06-25-2005, 05:39 PM Help with pop-up window
MartinS's Avatar
Novice Talker

Posts: 5
Location: Surrey, UK
Trades: 0
Hi
Am new to all this, so please be gentle with me. I have created a mail-to window containing a SWF which I want to link to from a piece of text. Looking through a few searches, I came up with the following solution, but guess what - it doesn't quite work and I don't know why.
In the HEAD section:
Code:
<script language="JavaScript" type="text/JavaScript">
function openpopup(){
window.open('http://www.mywebsite.co.uk/demo/contact.htm','contact','width= 497,height=435,resizable=no,scrollbars=no,directories=no,location=no,menubar=no,
top='+((screen.availHeight/2)-(435/2 ))+',left='+((screen.availWidth/2)-(497/2 ))+'')
}
</script>
Then to create the link, I've used
Code:
<a href="http://www.mywebsite.co.uk/contact.htm" onclick="openpopup()">HERE</a>
It opens the page correctly, but the page is full-size, not the size I want it to be (as defined in the function)
Can anyone please tell me what I've done wrong?
Any help/advice gratefully received
Regards
Martin

Last edited by MartinS; 06-25-2005 at 07:42 PM.. Reason: Amendment to question
MartinS is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-26-2005, 01:58 AM
funkdaddu's Avatar
Web Design Snob

Posts: 635
Trades: 0
Works fine for me in Safari And Firefox, what browser you checking this in?
funkdaddu is offline
Reply With Quote
View Public Profile Visit funkdaddu's homepage!
 
Old 06-26-2005, 08:08 AM
MartinS's Avatar
Novice Talker

Posts: 5
Location: Surrey, UK
Trades: 0
Hi
Am testing in Firefox - the contact form is at the top of the page, but it opens it as a full page window, replacing the existing one, not as a smaller, new one as I'd hoped.
I definitely want it to open as a new window in a fixed size, and neither of these are working for me - so what are you doing differently?
I have created the page 'contact.htm' and saved it to the location in the function and the link - is there something i have to do when creating/saving 'contact.htm'?
Regards
Martin
MartinS is offline
Reply With Quote
View Public Profile
 
Old 06-27-2005, 12:02 PM
funkdaddu's Avatar
Web Design Snob

Posts: 635
Trades: 0
Hmmm... Do you have a live page I can look at?

If the popup is loading into another already loaded page, then you need to change the target. Try changing "contact" in the window opener to "_blank" this will always open a new window.
funkdaddu is offline
Reply With Quote
View Public Profile Visit funkdaddu's homepage!
 
Old 06-27-2005, 12:21 PM
MartinS's Avatar
Novice Talker

Posts: 5
Location: Surrey, UK
Trades: 0
To see it as it is, the contact page link is as above, and the link to it can be found at http://www.frankswanston.co.uk/demo/index1.htm

OK - found out what I was doing wrong. I need to change the following:

Code:
<a href="http://www.frankswanston.co.uk/demo/contact.htm" 
OnClick="openpopup()">HERE</a>
to:
Code:
<a href="http://www.frankswanston.co.uk/demo/contact.htm" 
OnClick="openpopup();return false">HERE</a>
And then for the Close, change
Code:
<a href="http://www.frankswanston.co.uk/demo/contact.htm" 
OnClick="close_window()">CLOSE WINDOW</a>
to:
Code:
<a href="java-script:;" 
OnClick="close_window()">CLOSE WINDOW</a>
Thanks anyway for your time
Regards
Martin
MartinS is offline
Reply With Quote
View Public Profile
 
Old 06-27-2005, 02:12 PM
funkdaddu's Avatar
Web Design Snob

Posts: 635
Trades: 0
OK, but you may also want to remove the line breaks in the middle of your opennpopup() command. You have line breaks in your window popup code and that was screwing up the script on my browsers. Glad it's working.
funkdaddu is offline
Reply With Quote
View Public Profile Visit funkdaddu's homepage!
 
Reply     « Reply to Help with pop-up window
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.24129 seconds with 12 queries