cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <p>Made this so I could search a user database from anywhere on a site I manage with much less fuss.</p>
<p>Use this as your bookmark location. Of course, change the .js file link to wherever you store yours.</p>
<p>This demo will not work.</p>
<code>
javascript:(function(){document.body.appendChild(document.createElement('script')).src='http://www.xyz.com/yourJavaScriptFile.js';})();
</code>
            
          
!
            
              /* ###

There are two JS files. 

*/

/* ### JS File 1 ### */

// Make a variable that holds a new <iframe> element. 
var ifrm = document.createElement("IFRAME"); 

// Choose the page you want to load into the <iframe>
ifrm.setAttribute("src", "http://www.monkeyseatkoalas.com"); 

// A bit of styling of the iframe. Lay it out as you wish. I choose width of 100% because I want it to operate like a second window.
ifrm.style.width = 100+"%"; 
ifrm.style.height = 600+"px"; 

// Attach the new <iframe> to the body of the page we're on. Caveats: <iframe> and goofing about with it only works when you keep everything in one domain. 
document.body.appendChild(ifrm);

// Now we have an iframe on our document. It has a position of [0]. So let's now do something odd -- let's attach ANOTHER JavaScript file to this new iframe page. Why? Because that makes it easy to manipulate that page  with a fresh JS file. Here you go: 
frames[0].document.body.appendChild(frames[0].document.createElement('script')).src='http://www.bigstoragethingy.com/yourOtherJSTrickeryFile.js';


/* ######

#########
########## JS File 2 ### 

#### */ 

// We don't want to do anything until the whole beast is loaded. Otherwise, we might not be able to access somthing we want, or calculations we do based upon elements in the page might not work. Still, it's your call. You might be able to run this at an earlier stage in the load. 
window.onload = function () {

  // Looky there at that .forms. w00t! Handy! In the brackets, we have the form's ID. If it doesn't have one, go ahead and give it one, and make your life easier. How? Hmm. I think document.forms[numberOfFormElementOnThePage].setAttribute('id', 'mySpecialCupcakeFormCheeseName');
  var getDatForm = document.forms["IDofYourForm"];

  // Well, we need to find and store the box we want to populate with something. So we just use our form, nicely stuck in a variable, and do that super-handy elements[x] to it. In a form, this refers to the <input> tag. So the first <input> tag in your form will be yourForm.elements[0].
  var getDatSearchBox = getDatForm.elements[1];

  // Gettin' all interactivey here. Yep, ask your friendly Web user to provide something he/she wants to find. Stick it in a variable.
  var nameToFind = prompt('Word to hunt for? Name? Ice cream? Doggy?');

  // Update your search box with that text. 
  getDatSearchBox.value=nameToFind;

  // BOOM! Submit your form. 
  document.forms["users_search"].submit();
};
            
          
!
999px
Loading ..................

Console