Forum Moderators: open
It is an enquiry form, because the form is quite wide I want the window to be say 200 px high so the visitor can see it is a new window - and continue browsing the site whilst adding items to the enquiry form.
Not being very good with Javascript I cobbled this together, but it doesn't work:
<a href="javascript:window.open('enquiry.php','','height=200,left=80,top=80')">ENQUIRIES</a>
Try it as a script. In your <head>:
<script type="text/javascript">
function openPopup(theURL)
{
window.open(theURL,'Title','toolbar=no,location=no,
directories=no,status=no,menubar=no,scrollbars=no,
resizable=no,width=800,height=400,top=80, left=80');
}
</script>
Then, in your <body>:
<a href="javascript:openPopup('address.php')" ...>
Do you have JavaScript debugging on? If so, what does it say?
You can put JavaScript in the href, as long as you preface your code with javascript:. This does not apply to onClick etc. as these are event handlers and expect a script of some sort.
However, putting scripts in the href is not best practice, and they are best left in the event handlers.
It works now :)
I did it this way:
<head>
...
<script type="text/javascript">
function openPopup(theURL) { window.open(theURL,'Title','toolbar=no,location=no, directories=no,status=no,menubar=no,scrollbars=yes, resizable=no,width=820,height=400,top=80, left=80'); } </script>
</head>
<a href="javascript:openPopup('enquiry.php')">ENQUIRIES</a>
I would have preferred a method without putting stuff in the head tag as it is more to manage when I update things. But it works, so I am happy - thanks