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%;}

Thanks!

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:-

[code=html]
<html>
<head>
<script>
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 + ":";
}
}
}
</script>
</head>

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

</html>
[/code]

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()

[code='javascript']
//Delete Function
function deleteRow(r)
{
var i=r.parentNode.parentNode.rowIndex;
document.getElementById('TableMain').deleteRow(i);

// Decrementing row_no
row_no--;

}
[/code]

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

[code=javascript]
setInterval("sendRequest()", 2000 );
[/code]

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.

[code='javascript']
// 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;
gl.className='cellData';
gl.style.width='220px'
gl.style.height='17px'
gl.value='mm/dd/yyyy'
// Removed your handlers from here and putted it below
cellLeft.appendChild(gl);
document.getElementById("no_of_applications").value=iteration

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

// 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
inputFieldArray.push(gl);
erSpanArray.push(erSpan);

}
[/code]

Now the function to validate all fields will be:

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

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).

[code='javascript']
function ValidateForm()
{
alert("hi from ValidateForm")
//var dt=document.transaction.application_doj' + iteration
//alert(dt)
iteration=document.getElementById("no_of_applications").value
alert(iteration)
var dt=document.getElementById("application_doj" + iteration).value
// var dt=document.getElementById("application_doj2").value

alert(dt)
if (isDate(dt.value)==false){            // dt.value is undefined, pass only dt
    //dt.focus()
    return false
}
else
{
document.getElementById("DOJ_error").innerHTML=""
return true
}

}
[/code]

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:

[code='javascript']
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  
    root.removeChild(allChilds[i]);
        }
}
document.body.innerHTML = root.innerHTML;

}
[/code]

itsjareds commented: Thanks for the help +1

[code='javascript']
<html>
<head>
<title>test</title>
<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() {
                alert(hoverText);
                myDiv.style.backgroungImage = "url(" + hoverText + ")";
            }

            myDiv.onmouseout = function() {
                alert(bgText);
                myDiv.style.backgroungImage = "url(" + bgText + ")";
            }
        }
    </script>

    <style>
        #mydiv {
            border: 1px solid black;
            width: 100px;
            height: 100px;
        }
    </style>        
</head>

<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"/>
</body>

</html>
[/code]

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:

if(strcmp(str1,str2)==0);

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.
/

include<stdio.h>

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++){
scanf("%d",&num[i]);
}
even_number = odd_number = positive_number = negative_number = 0;
for(i=0;i<=4;i++){
if(num[i]%2==0){
//printf("\nEven number : %d",num[i]);
even_number++;
}
if(num[i]<0){
//printf("\nNegative number : %d",num[i]);
negative_number++;
}
//like the above, for the last two types of numbers.
if(num[i]%2!=0){
printf("\nOdd number : %d",num[i]);
}
if(num[i]>=0){
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;
}

[/CODE]

Now it will pass both conditions for odd and positive.

[code=JavaScript]var divEls = document.getElementsByTagName("div");
var i = 0;
for(i=0;i<divEls.length;i++)
alert(divEls[i].id);[/code]

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:

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

here is the HTML code

[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>
</select>

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

Check this out.

peter_budo commented: Nice exaples +8