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

Posts in category Web Development

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 Javascript - Tagged alert, contain, Javascript, string, variable

Web Dev> CGI-based redirect

Oct26
2010
Written by Scott Rowley

Recently I replaced an old .cgi file with a shiny new .php page. I realize everyone is still linking to the old .cgi file so I had need to forward them all onto the sexy new page. This can be accomplished as easily as the following:

Simply replace (after backing up) your .cgi file with the following contents

#!/path/to/perl
print "Location: http://domain.com/newpage.php\n\n";
Tagged cgi, code, Perl

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 Javascript - Tagged code, Javascript, reference
Newer Entries »

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