Web Programming Tip -
JavaScript

by Jon Schlackl

All SEO Articles

This article from The Mender (Issue 1),
Metamend's Web Site Optimization and Marketing Newsletter.


Javascript: Ever wanted to have a "print" button inside your web page so the user doesn't have to use the print button in the browser?? Well, here is a little code that will give it to. This small piece of Javascript invokes the browser's print function directly. Cut and Paste this code for use:

<a href="Javascript:window.print();">PRINT</a>
Note: replace the "PRINT" label with other text or an image for the print button.

Perl: Parsing out the filename and/or path from a string can be tricky, but very useful. Check these out!

$filename =~ s/.*\///;        - isolates filename
$path =~ s/.*\/.*/$1/;        - isolates path
OR to get both:
if($string =~ /.*\/.*/){
   $path = $1;
        $filename = $2;}

Other articles from this issue:
- Administrator's Corner
- Web Browsers

Sign Up Below!

If you would like to receive upcoming issues of The Mender, please enter your email address below and we will automatically add you to our mailing list.

Email address: