Contact Jan Thomas Consulting

May 12, 2007

Opening a new window: Play video in its own window, Open a Contact Form

Filed under: Programming Techniques — jan @ 11:55 am

Play a video in its own window or bring up a contact form. Controlling the window properties can add a professional touch to any website. Learn how to use the open method to bring up a web page in a new window.

View an Example: Chocolate Souffle Video From YouTube

View another Demo: This video takes longer to load.

Bring Up A Contact Form

Adding a YouTube Video into a new window:

  • Bring up a Video in YouTube.com
  • Right-mouse click on the video and select “Copy embed html”. (HTML code is copied to the clipboard.)
  • OR Click the Embed link below the video. Copy the selected code.
  • Paste code into a new html page
  • Use the open.window to call your new html page.

Here’s the open window call:

 
<a href="#" 
   onclick="window.open('http://www.sonrisasdental.org/video.html', 'sonrisasdental', 'toolbar=no,location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=550, height=450');" 
   class="uline" >View the Demo
   </a>

open method parameters:

  • URL – instead of adding the url to the href attribute, it is the first parameter of the open method. Add a # to href so it will behave like a hyperlink.
  • Name – gives a name to the window. (This is not the page title.)
  • Features – here are some features:
    toolbar = {yes | no} – display the toolbar
    location = {yes | no} – displays the browser’s location in the window.
    directories = {yes | no} – displays the directory buttons.
    status = {yes | no} – displays the window’s status bar.
    menubar = {yes | no} – displays the menus.
    scrollbars = {yes | no} – controls the display of scrollbars for the window.
    resizable = {yes | no} – can the window be resized?
    width = {number} – defines the width of the window in pixels.
    height = {number} – defines the height of the window in pixels.
    left = {number} – left margin of the window in pixels.
    right = {number} – right margin of the window in pixels.

Here’s an implementation using a button instead of a hyperlink:

Here’s the call from a button:

 
<form method="POST" name="contactjan" >
<input type = "button" value = "Contact Jan" 
  onclick = "window.open('http://www.janbthomas.com/jansblog/contact/','contactjan','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=550, height=500');" />
</form>

RELATED ARTICLES:
http://www.pageresource.com/jscript/jwinopen.htm

1 Comment »

  1. [...] Want more contact with your website visitors? CFormsII is a WordPress plugin created for just that purpose. View Post Comments [...]

    Pingback by mySource » Create a Contact Form in WordPress — December 8, 2009 @ 2:04 pm

RSS feed for comments on this post. TrackBack URL

Leave a comment

© 2011 JanBThomas Last Updated January 2011. Privacy Policy

Powered by WordPress