• Home
  • Shell
    • Emacs
    • Perl
    • screen
    • sed
  • Ubuntu
    • VNC
  • Web Development
    • Javascript
    • Joomla
    • MySQL
    • osTicket
  • Windows
    • Gimp

Posts tagged Javascript

Web Dev> Use onFocus to clear a value and onBlur to replace empty values

Oct17
2011
Written by Scott Rowley

The following can be used to clear a value. I regularly use this for website search bars.

<script>
function blank(a) { if(a.value == a.defaultValue) a.value = ""; }
function unblank(a) { if(a.value == "") a.value = a.defaultValue; }
</script>
<input type="text" value="email goes here" onfocus="blank(this)" onblur="unblank(this)" />

This post was updated using code found here, which I think works a little nicer.

Posted in Web Development - Tagged clear, dev, development, html, onclick, this, value, web

osTicket> View headers for original email message

May25
2011
Written by Scott Rowley

This MOD will allow you to view the original email message headers. The headers also take alot of screen space so we have them “hidden” by default but you can click a link to expand and view them.

1.6ST: If you have not yet modified include/staff/viewticket.inc.php or scp/js/scp.js then you can simply download the following files and replace them. As always, make backups of your local files first.
Download

Hidden Shown
Hidden headers Shown headers

READ MORE »

Posted in osTicket - Tagged address, email, header, headers, hide, mod, modification, original, osTicket, show, ticket

Javascript> Check if string contains VARIABLE

Oct26
2010
Written by Scott Rowley

Just a bit of code to help you find whether or not a certain word/phrase/letter/number/whatever is present in something like a form entry.

if (TEXT.match(/b<VARIABLE>b/i) != null) {
alert(true);
}

For instance, I have a domain registration form and we know there are no spaces allowed in domain names, so:

if (TEXT.match(/b b/i) != null) {
alert(true);
}
Posted in Web Development - Tagged alert, contain, string, variable

Javascript> Reference Javascript (.js) file

Oct26
2010
Written by Scott Rowley

Sometimes we have so much javascript code in our files that it just becomes bulky and gets in the way. Instead of including it all in your file, save it all to a seperate file that can be referenced in your page (or better yet multiple pages).
Simply place the following within your <head> tags:

<script language="javascript" src="/path/to/file.js"></script>
Posted in Web Development - Tagged code, reference, Web Development

Corrections? Questions? Comments?

Find an error?
Everything work out great for you?
Have some feedback?
Like to see something added to the article?

PLEASE leave us a comment after the article and let us know how we are doing, or if something needs corrected, improved or clarified.

Thank you!
- The Management

Advertisement

Sudo Bash
By Geeks - For Geeks

Back to Top