height of an relative positoned element in % is caclulated on the basis of its parents. You need to set height of parent. In case parent is body you can add following css to make your dive work:-

html,body{height: 100%;}


There was an error while checking on Chrome as on FireFox its messe up, The error was at index.php:139

[COLOR="Red"]Uncaught TypeError: Cannot read property 'value' of null[/COLOR]

Resolve this.

KPheasey commented: Found the problem +1

Try this:-

function doInsert(inp) {
var v = inp.value;
var l = v.length;
var maxLen = 17 // Length of mac string including ':'
if(l >= 2 && l < maxLen) {
var v1;
v1 = v;
/ Removing all ':' to calculate get actaul text /
while(!(v1.indexOf(":") < 0)) { // Better use RegEx
v1 = v1.replace(":", "")
/ Insert ':' after ever 2 chars /
if(v1.length%2 == 0) {
inp.value = v + ":";

    <input type="text" maxlength="17" onkeydown="doInsert(this);"/>


Its sometimes good to reinvent wheel ... I just did :p

Eclipse, aptana both are free and good

[CODE=javascript]<img src="austria.jpg" name="im1" height="300" width="300" onclick="window.open('http://google.com')"/><br/>
<button onclick="document.images.im1.src='austria.jpg'; document.images.im1.onclick='window.open(\'Austria">http://google.com\')'">Austria</button>
<button onclick="document.images.im1.src='korea.jpg'; document.images.im1.onclick='window.open(\'Korea">http://yahoo.com\')'">Korea</button>
<button onclick="document.images.im1.src='brazil.jpg'; document.images.im1.onclick='window.open(\'Brazil">http://chapo.co.cc\')'">Brazil</button>[/CODE]

Your are incrementing 'row_no' in addRow() but not decrementing it in deleteRow()

//Delete Function
function deleteRow(r)
var i=r.parentNode.parentNode.rowIndex;

// Decrementing row_no


Use setInterval() method instead of setTimeout(). setInterval will repeatedly call a function at given interval

setInterval("sendRequest()", 2000 );

Few checks:-

  1. Check if pipe is opened properly.
    [CODE]if(al != NULL)[/CODE]

  2. Check if your command is actually outputting something.

Thats all I can see missing in the code.

Adding one more
[CODE]if( c[i] [COLOR="red"]=[/COLOR] '\t')[/CODE]
will be always true

Bad coding:-
[CODE]for( i = 0 ; i <= ([COLOR="Red"]x = (strlen(c)[/COLOR])) ; i++)[/CODE]

Here every iteration will call strlen(c)....which is bad. Store the length once before loop starts.

Ancient Dragon commented: Agree. +27

This can be done in many ways, but I will tell you easiest way:

Your function error_appname(inputField, erSpan), requires 2 argument, so maintain global arrays for those.

// Global arrays used to hold input fileds and error spans
var inputFieldArray = [];
var erSpanArray = [];

function addRow()
// Some of your code

gl.type = 'text';
gl.name = 'application_doj' + iteration;
gl.id = 'application_doj' + iteration;
gl.size = 45;
// Removed your handlers from here and putted it below

//Adding span for showing validation error
var erSpan = document.createElement('span');
// Add error span to this cell.

// Here goes ur handler
gl.onfocus= function() {gl.value=""};
gl.onblur= function() {ValidateForm(erSpan)}; // Passing erSpan, so that we can easily show error message

// Push elements in global arrays


Now the function to validate all fields will be:

function validateAll() {
var totalRows = inputFieldArray.length; // OR erSpanArray.length
for(var i = 0; i < totalRows; i++) {
error_appname(inputFieldArray[i], erSpanArray[i]);

peter_budo commented: Nice example +22
aashishn86 commented: ingenious,simple n elegant... thanks :) +2

You assigned:
var dt=document.getElementById("application_doj" + iteration).value

dt has already got value. So pass only dt in isDate(dt).

function ValidateForm()
alert("hi from ValidateForm")
//var dt=document.transaction.application_doj' + iteration
var dt=document.getElementById("application_doj" + iteration).value
// var dt=document.getElementById("application_doj2").value

if (isDate(dt.value)==false){            // dt.value is undefined, pass only dt
    return false
return true


aashishn86 commented: thanks :) +2

Well Airshow,

I wrote these function on STB browsers, which do not support prototyping of predefined objects like Date.

But your effort is really appreciated.

m-hrt commented: thanx for the help +1

[B]getElementById()[/B] only works with [B]document[/B]. To parse your HTML can use [B]childNodes[/B];

Modifying your code all little bit:

function parseHTML(html) {
var root = document.createElement("div");
root.innerHTML = html;

    // Get all child nodes of root div
    var allChilds = root.childNodes;
    // Loop through all the child nodes and check for id = 'head'
for(var i = 0; i < allChilds.length; i++) {
        // if id == 'head', you get your element
    if (allChilds[i].id && allChilds[i].id == "head") {
        // Remove it from root  
document.body.innerHTML = root.innerHTML;


itsjareds commented: Thanks for the help +1

<script type="text/javascript">

        function applyStyle() {
            var bgText = document.getElementById('bg').value;
            var hoverText = document.getElementById('hover').value;
            var myDiv = document.getElementById('mydiv');

            myDiv.style.backgroungImage = "url(" + bgText + ")";
            myDiv.onmouseover = function() {
                myDiv.style.backgroungImage = "url(" + hoverText + ")";

            myDiv.onmouseout = function() {
                myDiv.style.backgroungImage = "url(" + bgText + ")";

        #mydiv {
            border: 1px solid black;
            width: 100px;
            height: 100px;

<body >
    <label>BG:</label><input id="bg" type="text"/> 
    <label>Hover:</label><input id="hover" type="text"/>
    <input type="button" onClick="applyStyle()" value="apply">
    <div id="mydiv"/>


arvindikchari commented: Gave the required solution to the problem +1

Simply you have to parse the server response manually.

For example you get this a client side:

responseText = "field1||fiel2||field||......";

Then using javascipt string-functions to separate all the fields and use the your method of innerHTML to populate other text fields.

tuse commented: good idea! +2

hey manavsm,

In deletion u have compared the rollno(which is string) with '==' operator, which is wrong. In C string are not compared with '==' operator but there is function defined in string.h ie strcmp();

How to use:


here str1 and str2 are strings if they are same then strcmp(str1,str2) will return 0.

Use this function to compare string. As Strings are nothing but a char pointer and comparing them with '==' will compare the addresses of both the pointers not the string.

Good luck!!

jephthah commented: youre so nice to the silly noobs. i just thought i'd tell you that, so now my cookie-karma is back to baseline. +4

"While you learn basics of Java web development you are not doing complex stuff"

And what is that complex stuff. can u please explain me.

R0bb0b commented: You are one cool dude. +1

Hey Wait!!

U want to find out how many of them are positive, how many are negative, how many are even and how many odd. But your code will give wrong result. For example u entered 5 as one of the five numbers, then ur code will consider it as odd and but it is also a positive number. But because u have used nested if-else it will consider it odd only(not positive). To avoid this change ur code like this:

[CODE]/Twenty-five numbers are entered from the keyboard into an array.
Write a program to find out how many of them are positive,
how many are negative, how many are even and how many odd.


int main()
int num[5];
int i, even_number, odd_number, positive_number, negative_number;

printf("Enter 5 int numbers ");
for (i=0;i<=4;i++){
even_number = odd_number = positive_number = negative_number = 0;
//printf("\nEven number : %d",num[i]);
//printf("\nNegative number : %d",num[i]);
//like the above, for the last two types of numbers.
printf("\nOdd number : %d",num[i]);
printf("\nPositive number : %d",num[i]);

printf("\n There were %d even numbers, %d odd numbers, %d negative numbers, and %d positive numbers",
even_numbers, odd_numbers, negative_numbers, positive_numbers);

return 0;


Now it will pass both conditions for odd and positive.

[code=JavaScript]var divEls = document.getElementsByTagName("div");
var i = 0;

scorpionz commented: This Luckychap is a good person to talk with. Understand the Points, Nicely +2

if its taking too much time, here is your whole code:

Javascript function:

function CheckForCreditCard(el) {
if (el.options[2].selected == true)
var CreditCardInfo = document.getElementById("cci_div");
CreditCardInfo.style.visibility = "visible";

here is the HTML code


<select name="selPayment" onchange="CheckForCreditCard(this);">
<option value="Cash">Cash</option>
<option value="Check">Check</option>
<option value="Credit Card" selected="selected">Credit Card</option>

<div id="cci_div"> <br />
Card Number:
<input name="selCreditCardInfo" size="20" type="text" />
<input type="text" name="txtMonth" size="4" />
<input name="txtYear" size="4" type="text" />

Check this out.

peter_budo commented: Nice exaples +8