Code Snippets

  

JavaScript Source Code


Welcome to Dream.In.Code
Become an Expert!

Join 137,221 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,167 people online right now. Registration is fast and FREE... Join Now!





Open any media in a new window

pass the id of the media element. It will be opened in a new window the size of the media supplied.

Submitted By: William_Wilson
Actions:
Rating:
Views: 304

Language: JavaScript

Last Modified: December 31, 1969
Instructions: Add to your javascript code and call with the document object to open the media in a new window.
Note that the name of the window you create cannot have a space in it!

Snippet


  1. function new_win(id)
  2. {
  3.         var m = document.getElementById(id);
  4.         if(m != null)
  5.         {
  6.                 var source = m.src;
  7.                 source = document.domain + source; //most webpages will use dynamic linking, if they don't remove document.domain
  8.                 window.open(source,'Media_Window','width='+m.width+',height='+m.height+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=no');
  9.         }
  10. }

Copy & Paste


Comments


There are currently no comments for this snippet. Be the first to comment!

Add comment


You must be registered and logged on to </dream.in.code> to leave comments.





Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month