Pls Help!

I im only just learning javascript and in need of some help please if you can.

Ive been given a simple programme to do and it is asking for a simple function to leavegaps. Only im not finding it so simple and this is the last part i need to complete.

so instead of just using

document.write('

')

i have to write a function to do this,

function toleaveGap(number of gaps)
{
}

Comments

  • : I im only just learning javascript and in need of some help please if you can.
    :
    : Ive been given a simple programme to do and it is asking for a simple function to leavegaps. Only im not finding it so simple and this is the last part i need to complete.
    :
    : so instead of just using
    :
    : document.write('')
    :
    : i have to write a function to do this,
    :
    : function toleaveGap(number of gaps)
    : {
    : }
    :

    Hi

    Try this :
    [code]


    Gap

    function toleaveGap(ElemId, NumGaps)
    {
    var AuxStr = "";
    for (aa=0;aa < NumGaps;aa++)
    AuxStr += "
    ";
    ElemId.insertAdjacentHTML("afterEnd", AuxStr);
    }



    000

    111

    222

    333

    444

    555

    666

    777




    [/code]
    The ElemId is the element id of the element after wich you want
    to place the gap, and the NumGaps is the Number of gaps.

    Hope it helps.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion