Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8392223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:27:51+00:00 2026-06-09T19:27:51+00:00

<html> <head> <title>something</title> <link rel=stylesheet href=../../style/global.css> <link rel=stylesheet href=../../style/local.css> <link rel=stylesheet href=../../calendarControl.css> <script Language=JavaScript

  • 0
<html>
<head>
    <title>something</title>
    <link rel="stylesheet" href="../../style/global.css">
        <link rel="stylesheet" href="../../style/local.css">
        <link rel="stylesheet" href="../../calendarControl.css">
        <script Language="JavaScript" src="../jscripts/util.js"></script>
    <script language="JavaScript" src="../../calendarControl_modi.js"></script>
    <style>
    input.normal
    {
    text-transform:uppercase;
    }
    </style>
    <script>

    function addBox()
    {   
        //y;
        y=2;
        alert(y);
        var form=document.frm;

        var _items = [ 'NA', 'Storage Device', 'Imaging Device'];

        var label, textbox,lable2,select,div;

        label = document.createElement('label');

        label.appendChild(document.createTextNode('Belonging Type '+y+ ':'));

        select = document.createElement('select');

            for ( var x = 0; x < _items.length; x++ ) 
            {
             _option = document.createElement('option');
             var _text = document.createTextNode(_items[x]);
             _option.appendChild(_text);
             select.appendChild(_option); 
             _option.value = _items[x];
            }

        label2 = document.createElement('label');

        label2.appendChild(document.createTextNode('Belonging '+y+ ':'));

        textbox = document.createElement('input');
        textbox.type = 'text';

        label.appendChild(select);
        label.appendChild(label2);
        label.appendChild(textbox);

        div=document.createElement('div');
        div.appendChild(label);
        document.getElementById('frm').appendChild(div);

        y=y+1;
        alert(y);


        }

        function removeBox() 
        {
        var form = document.frm;
        if (form.lastChild.nodeName.toLowerCase() == 'div')
        form.removeChild(form.lastChild);

        }

        function incrementCount() 
        {
        document.frm.count.value = parseInt(document.frm.count.value) + 1;
        addBox();
        }

        function decCount() 
        {
        document.frm.count.value = parseInt(document.frm.count.value) - 1;
        removeBox();
        }

    </script>

</head>

<body leftmargin="2" topmargin="2" marginwidth="2" marginheight="0" onload="">
<table border = "0" cellspacing="0" cellpadding="0" width = "100%">
            <tr>
                <td class = "normal" align = "left" colspan = "100%" >
                    <!-- Put the Header Image over here-->
                <!--<img src="../../images/ts.gif" width="10%" >-->
                <td>
            </tr>
    </table>
    <!--<img src="../../images/line.bmp" width="100%" height="2">-->

    <form name  = "frm" method = "post" action="" >
    <table>
    <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td><input type="hidden" name="count" value="0" readonly ></td></tr>
    <tr>
        <td><a href="javascript:incrementCount();" onclick="" class="underline_small">Add more</a></td>
    </tr>
    <tr>
        <td><a class="underline_small" href="javascript:decCount();" onclick="">Remove<a></td>
    </tr>

</table>
</form>
</body>
</html>

The output I am getting is as follows

enter image description here

after clicking on remove I am able to remove added element but when I press again Add more value of y remains same which I want to increment next time when I will click Add more it should show Belonging Type 3 and how can we apply style to dynamically added element as I applied to hyperlink Addmore and remove.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T19:27:53+00:00Added an answer on June 9, 2026 at 7:27 pm

    I think the problem is that you have set y = 2 inside addBox() function. Change it to
    y=document.getElementsByName('count')[0].value;

    Demo: http://jsfiddle.net/pEAH8/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm breaking my head over this code: <html> <head> <title>Westpop</title> <link rel=stylesheet href=opmaak.css> </head>
Html: <html> <head> <title>Tooltips</title> <link rel=stylesheet type=text/css href=tooltips.css /> </head> <body> <ul> <li tabindex=1>
This is my index.jsp : <!DOCTYPE html> <html> <head><title>Bank application</title> <link rel=stylesheet href=./css/styles.css type=text/css/>
If I have the following HTML: <!DOCTYPE html> <html> <head> <title>Test</title> <link href=base.css rel=stylesheet/>
I have some HTML Code: <html> <head> <title>css test</title> <style type=text/css> .box{width:100%;float:left;background:red} </style> </head>
<code> <html xmlns=http://www.w3.org/1999/xhtml> <head> <title>jQuery.pager.js Test</title> <link href=Pager.css rel=stylesheet type=text/css /> <script src=jquery-1.2.6.min.js type=text/javascript></script>
Take a look at this html: <head> <title>Test page</title> <script type=text/javascript> function submitForm() {
Heres my simple html source <html> <head> <title> Dec2Bin </title> <script type=text/javascript> function app()
I have this html code <html> <head> <title>JQuery Problem 2</title> <script type=text/javascript src=jquery-1.4.min.js></script> <script
Basicily i have a index.html shown below.. <html> <head> <title>UI Test: Main Menu</title> <script

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.