Friday, June 25, 2010

Display a Triangle format Numbers using PHP code

Hi All,
Program to Display following using php code:
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15

CODE:
Start php here
$k=1;
for($i=0;$i<5;$i++){
for($j=0;$j<=$i;$j++){
echo $k." ";
$k++;
}
echo "
";
}
End php tag

Check out the output...


All d best

Thursday, June 24, 2010

CKEDITOR configuration to change Default settings

Hi All,
I need to modify a default setting in CKEDITOR for changing paragraph format in the editor to except "DIV" tags.
So i googled & worked on the configuration of CKEDITOR,finally i got a file i.e "ckeditor.js" located (ckeditor/ckeditor.js) and

Default Setting
enterMode:1
We need to modify
enterMode:3


Now check ur output i will set to "Normal(div)" format.


All d Best

Monday, June 14, 2010

Validation for Radio Button in Javascript

Hi Programmers,
I just faced little difficult to validate radio box element using java script but i think most of the developer had done lot of script on radio box validation.

For my sake i am posting blog on validation on radio box.

function valButton(btn) {
var cnt = -1;
for (var i=btn.length-1; i > -1; i--) {
if (btn[i].checked) {cnt = i; i = -1;}
}
if (cnt > -1) return btn[cnt].value;
else return null;
}

function valForm(form) {
var btn = valButton(form.group1);
if (btn == null) alert('No radio button selected');
else alert('Button value ' + btn + ' selected');
}