473,322 Members | 1,431 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

How to create form element dynamically

Hi,

I have the following Script, which dynamically creates divs

Expand|Select|Wrap|Line Numbers
  1.   <div id="scr1" style="width: 784px; cursor:pointer;">
  2.       <script language='javascript' type='text/javascript'>
  3.            <%
  4.             i = 0
  5.             While i < Counter
  6.                   MyBase.Response.Write("var NewDiv = document.createElement('div');")
  7.                   MyBase.Response.Write("NewDiv.Id ='Div" + i.ToString + "';")
  8.                   MyBase.Response.Write("NewDiv.className ='default';")
  9.                   MyBase.Response.Write("scr1.appendChild(NewDiv);")
  10.                   MyBase.Response.Write("NewDiv.innerHTML = '" + DataTableObject.Rows(i)(2).ToString() + "';")
  11.                   i = i + 1
  12.            End While
  13.        %>
  14.    </script>
  15.   </div>
  16.  
i am fetching the Counter value and the innerHTML from the database using VB.net and using try catch handler
It works fine in IE,Opera and Chrom however, it doesn't seem to work with Firefox. Nothing happens in Firefox when load the page.

Please Help

Thanks in advance for any help.
May 23 '10 #1

✓ answered by gits

i suspect that you would need to retrieve the node where you want to append correctly with - the following line:
Expand|Select|Wrap|Line Numbers
  1. MyBase.Response.Write("scr1.appendChild(NewDiv);")
should look like:
Expand|Select|Wrap|Line Numbers
  1. MyBase.Response.Write("document.getElementById('scr1').appendChild(NewDiv);")
?

kind regards

2 1623
gits
5,390 Expert Mod 4TB
i suspect that you would need to retrieve the node where you want to append correctly with - the following line:
Expand|Select|Wrap|Line Numbers
  1. MyBase.Response.Write("scr1.appendChild(NewDiv);")
should look like:
Expand|Select|Wrap|Line Numbers
  1. MyBase.Response.Write("document.getElementById('scr1').appendChild(NewDiv);")
?

kind regards
May 23 '10 #2
@gits
thank u so much for your help gits
it worked
May 23 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Don Stefani | last post by:
Hello, I have a form that I want to submit "onchange", OK I've got that working, but when the form submits, I want to pass along a value to a CGI script, as if that value was in a hidden form...
6
by: Andrew Poulos | last post by:
I'm trying to append a form element to a form like so: var frm = document.createElement("FORM"); frm.method = "post"; frm.action = "include/writeData.asp"; var ff, values = ; for (var i=0;...
5
by: Angel | last post by:
Is there a way to create an IFRAME dynamically via VB.NET. In other words creating the HTML element in the server side code? thanks in advance....
3
by: michael | last post by:
let me keep it clean, quick and simple. I am passing a variable into another window and am reassigning the value on the new page - window.document...value = opener.document. ....value and...
15
by: Christoph | last post by:
I'm trying to make it so that if the user sets focus to a form element (text), it automatically sets focus to the very next form element. This will, in effect, prevent the user from modifying the...
3
by: vincentshiu | last post by:
I need to dynamic create input element in some cases, and I use javascript to do that, like the following code: .... var inputElement = document.createElement("input"); this.inputElement.name=...
2
dlite922
by: dlite922 | last post by:
Before traversing my code, here's what my goal is and what this function does: I have a table of fields that dynamically grows as the user enters information. A minimum of 3 rows must always...
3
by: MitchellEr | last post by:
Hi, I am in the process of creating several forms where a group of elements on the form need to be created dynamically. For example, in the case of one of the forms, I have a drop down for...
9
by: student4lifer | last post by:
Hello, could someone show me how to make sticky form with dynamically generated form element? for example, if one likes to make the dynamically generated check box (and its name) 'sticky' that...
7
by: chrismaliszewski | last post by:
Hi. I created code which makes dynamically form with bounded controls for all columns. I show it to you below. My problem is, how I have to change this code to create form which record source...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.