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

Posts in category Javascript

Javascript> Check for specific email address

Mar16
2011
Written by Scott Rowley
<script>
//function to check for a specific email address
function donotreply()
{
if (document.forms["reply"]["send_to"].value == 'do-not-reply@example.com')
{
alert('You would try to send to the one address yer not allowed to....try again!');
return false;
}
return true;
}
</script>

And the form entries…

<form name="reply" onsubmit="return donotreply()">
<input type="text" name="send_to">

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.

We recommend to use online surveys for money.

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:

BeoX complaints

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