Help with fix size pop page please

Please HELP

I have been trying for ages to get a fix size pop up php or html page to work from a click the link on my website (word press)

I have some code that should display an iframe fix size 425 x 245.

How do i link to this code from a page

what is happening to me now is if i try to open this page the code displays and not the actual pop page it shows the code (i know i am not executing the script

All i am trying to do is get this pop to stay active after it is activated and the user continues normal browsing

The code is here i have nt got this to work so i can only guess its correct

I have no code knowledge How do i link to this page to get this to work from a word press page the pop up must be independent to the word press site.

<html>
<head>
<script language=“JavaScript” type=“text/javascript”>
function makeFrame() {

  • *ifrm = document.createElement(“IFRAME”);
  • *ifrm.setAttribute(“src”, “http://fplayer.newradio.it/saintfm/”);
  • *ifrm.style.width = 452+“px”;
  • *ifrm.style.height = 245+“px”;
  • *document.body.appendChild(ifrm);
    }
    </script>
    </head>
    <body>
    <p><a href=“#” onMouseDown=“makeFrame()”>GO! </a></p>
    </body>
    </html>

Hi there,

So, the reason why this isn’t working in your demo is that you are trying to reference an element in your JavaScript, before it exists on the page.
Put your JS just before the closing </body> tag and that will solve that particular problem.
It might also be better to remove the inline event handler.

<!DOCTYPE HTML>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Append iframe on click</title>
  </head>
  
  <body>
    <p><a href="#" id="go-button">GO!</a></p> 
    
    <script language="JavaScript" type="text/javascript"> 
      function makeFrame() { 
        var ifrm = document.createElement("iframe"); 
        ifrm.setAttribute("src", "http://fplayer.newradio.it/saintfm/"); 
        ifrm.style.width = 452 + "px"; 
        ifrm.style.height = 245 + "px"; 
        document.body.appendChild(ifrm); 
      } 
			
      var g = document.getElementById("go-button");
      g.onclick = makeFrame;
    </script> 
  </body>
</html>

Pullo thank you i know a little HTML and that is it but i am going to learn my self as it brings so much frustration

I have one more question if i want to open this pop up page now do i link to the url of the page or do i have to call the script from my word press webpage in some way

i take it this pop up window will stay active until manually close ( to allow continued browsing)

so grateful for your input some thing that lots so simple is making me pull my hair out

JC

Hi there,

All you are doing with the code you posted is creating an iframe and appending it to your document.
This is not the same as opening a popup window and, as such the iframe cannot be “closed” (although you could programmatically remove it).

If you want to have the iframe get focus like a popup window, as well as be closeable, you might want to display it using a modal dialogue.
e.g. http://www.ericmmartin.com/projects/simplemodal/

Thank you for your help i think its time to call a developer in to take care of this as i want to make sure its 100 % correct appreciate the help