The following example allows only number character in text field.
<script type=”text/javascript”>
function numberOnly(textField,e,isDecimal) {
// isDecimal = true for double
// isDecimal = false for integer
var key;
var keychar;
if (window.event) {
key = window.event.keyCode;
}
else if (e) {
key = e.which;
}
else {
return true;
}
// check double period,decimal,point
if ( ((textField.value).indexOf(‘.’) > -1) && key == 46){
alert(“Double period is not allow for this field.”);
return false;
}
var [...]
Archive for April, 2009
Javascript Allow Number Only In TextField
Getting The Domain Name Out Of A URL
In web programming, sometimes we need to get the domain name out of the url. Here how to do it:
<?php
// get host name from URL
preg_match(‘@^(?:http://)?([^/]+)@i’, “http://www.php.net/index.html“, $matches);
$host = $matches[1];
// get last two segments of host name
preg_match(‘/[^.]+\.[^.]+$/’, $host, $matches);
echo “domain name is: {$matches[0]}\n”;
?>
What’s the hell that code means!
Find If A String Contains A Certain Character
Here are list of functions that can be used to find a certain character in a string.
preg_match()
if (preg_match(“/php/i”, $string)) {
echo “A match was found. The string contains ‘php’ “;
} else {
echo “A match was not found.”;
}
ereg()
if(ereg(‘ ‘,$string)) echo ‘you have spaces’;
else echo ‘no spaces!’;
eregi()
if (eregi(‘z’, $string)) {
echo “‘$string’ contains a ‘z’ or [...]
- How to implement jQuery facebox plugin
- PEAR Install Spreadsheet_Excel_Writer
- PHP code to display Alexa rank
- PHP Configurations for Uploading File
- wp_insert_post could not insert post into the database
- PHP in_array() and array_search() functions
- Storing array data to MySQL using PHP
- How To Write print_r Output To File
- PHP Redirect Page
- Remove Non ASCII Characters From A String
- Avinash in PEAR Install Spreadsheet_Excel_Writ…
- paratenilesh in Extjs PHP MySQL Simple Tutorial
- yoube.info in Remove Mybrowserbar From My Browser…
- Alzuun in Remove Mybrowserbar From My Browser…
- RMK in Remove Mybrowserbar From My Browser…
- Laura in Remove Mybrowserbar From My Browser…
- Mitani in Remove Mybrowserbar From My Browser…
- Manila Director… in Remove Mybrowserbar From My Browser…
- Arak in Remove Mybrowserbar From My Browser…
- Angel in Remove Mybrowserbar From My Browser…
Rds Online
Promoting Online Products
Cheap PHP + MySQL ebook
Really cheap ebook (just 12$). Have a lot of information and examples about PHP and MySQL.
Honest Riches-Make Money Online the Honest Way
Most Sought-After Work at Home Guide, written by Holly Mann - single mom, disabled veteran. No Hype - Honest Legit techniques taught in a step-by-step guide. Also have access to 24/7 support forum. Sick of the scams? Learn to work at home for real.
- Remove Mybrowserbar From My Browser
- Javascript - Get URL Parameters
- Fireworks: Make Rounded Corner Edges Image
- Get Domain Name From URL Using Javascript
- Hp Proliant ml350 g6 Win2003 Server Setup Bluescreen
- Merge Table Cells Using Javascript
- Extjs PHP MySQL Simple Tutorial
- Wp-O-Matic Plugin Cannot Add Campaign
- Javascript: Open new window containing php page
- Mozilla Firefox Add-ons for Downloading YouTube Video
- check string convert ip to number convert ip to numeric value copy table to a new table copy table using mysql dll file domain name domain name from url Export Data fireworks horizontal line effect get domain from url get url parameters golfer social network import data javascript alert javascript alert method javascript dialogue box javascript get url parameter javascript load php page javascript open new window javascript open php page javascript pops up javascript prompt javascript tabbed page JQuery Example location href merge table cells Motion Trail Text mysql copy table mysql ip to number PC Router php compress file php create zip file php error PHP fatal error php how to upload file php ip to number php session how to php uploaded file rounded corner edges image url domain url domain name WinXP auto logon WinXP File Sharing zip using php