473,466 Members | 1,565 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

IE events on the fly

Cy
This works wonderfully in Firefox, but when it runs for the first time
in IE it only creates the field, but won't create any attributes for
the events. When debugging the events are null. How can I get this
to work in IE.

The table that looks like this

<table width="100%" border="1" cellpadding="0" cellspacing="2">
<tbody id="linkedTable">
<tr>
<td class="content">1) </td>
<td><input type="text" name="linked_form[]" id="linked_form1"
onKeyUp="cellHilite('linked', 'form'); addInputField('linkedTable',
'linked_form', '1', '90')" onBlur="cellHiliteOff()" size="90"></td>
</tr>
</tbody>
</table>

My script is like this
var fieldNum = 0;
function addInputField(tagID, fieldName, num, length) {
var newNum = 1+parseInt(num);
var funcText = "addInputField('" + tagID + "','" +
fieldName + "','" + newNum + "','" + length + "')"

if (document.getElementById(fieldName+num).value != '') {
row = document.createElement('TR');
cell = document.createElement('TD');
cell.setAttribute("class", 'content');
cell2 = document.createElement('TD');
cell2.setAttribute("class", 'content');
txt = document.createTextNode(newNum + ') ');
field_input = document.createElement('INPUT');
field_input.setAttribute("type", 'text');
field_input.setAttribute("id", fieldName + newNum);
field_input.setAttribute("name", fieldName+"[]");
field_input.setAttribute("size", length);
field_input.setAttribute("onKeyUp",
"cellHilite('linked', 'form'); "+funcText);
field_input.setAttribute("onMouseUp",
"cellHilite('linked', 'form'); "+funcText);
field_input.setAttribute("onBlur", "cellHiliteOff()");

if (fieldNum != num) {
document.getElementById(tagID).appendChild(row);
row.appendChild(cell);
cell.appendChild(txt);
row.appendChild(cell2);
cell2.appendChild(field_input);
}
fieldNum = num;
}
}


I had done this before, but without a table. The inputs were placed
on top of each other in a div tag. That code looks like this.
function addURLField(num) {
if
(document.getElementById('request_form')['url_'+num].value != '') {
url_input = document.createElement('INPUT');
url_input.setAttribute("type", 'text');
url_input.setAttribute("name", 'url[]');
url_input.setAttribute("id", 'url_'+ (1+parseInt(num)));
url_input.setAttribute("size", '127');
url_input.setAttribute("onKeyUp", "addURLField(\'" + (1+parseInt(num))
+ "\')");
url_input.setAttribute("onMouseUp", "addURLField(\'" +
(1+parseInt(num)) + "\')");
bold_tag = document.createElement("B");
numb = document.createTextNode((1+parseInt(num))+")-");
bold_tag.appendChild(numb);

if (probURLnumKeep != num) {
br_tag2 = document.createElement('BR');
document.getElementById('new_page_toggle').appendC hild(bold_tag);
document.getElementById('new_page_toggle').appendC hild(url_input);
document.getElementById('new_page_toggle').appendC hild(br_tag2);
}
probURLnumKeep = num;
}

}

Any help would be appreciated
Jan 12 '06 #1
1 3235

Cy wrote:
field_input.setAttribute("type", 'text');
field_input.setAttribute("id", fieldName + newNum);
field_input.setAttribute("name", fieldName+"[]");
field_input.setAttribute("size", length);
The setAttribute function does not work correctly in IE. Do this
instead:

field_input.type = "text";
field_input.id = fieldName + newNum;
field_input.name = fieldName + "[]";
field_input.size = length;
field_input.setAttribute("onKeyUp",
"cellHilite('linked', 'form'); "+funcText);
field_input.setAttribute("onMouseUp",
"cellHilite('linked', 'form'); "+funcText);
field_input.setAttribute("onBlur", "cellHiliteOff()");


Events are a different matter. You should be using addEventListener
and attachEvent (IE) methods. Please look them up on how to use them.

Jan 12 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Sasha | last post by:
Hi everyone, Here is my problem: I have the following classes: - DataNode - this class is designed to hold some data and will be contained in a tree like data structure DataTree. When...
6
by: Saso Zagoranski | last post by:
Hi! How can I unregister all the events registered to a control? I have seen a piece of code in another thread, which gets all the registered handlers for a specific event. Let's say I have a...
14
by: JPRoot | last post by:
Hi I use the following syntax to have events inherited from base to child classes which works nicely (virtual and override keyword on events). But I am wondering if it is a "supported" way of using...
2
by: Bob Rundle | last post by:
I have the following code, which appears to be working. However it doesn't look right. The part I am wondering about is the logic in DisconnectEvents(). This logic creates a new delegate and...
4
by: LP | last post by:
Hello! I am still transitioning from VB.NET to C#. I undertand the basic concepts of Delegates, more so of Events and somewhat understand AsyncCallback methods. But I need some clarification on...
11
by: Nicky Smith | last post by:
Hello, I'm studying a book on VB.net Win apps, and I'm reading a section on events and delegates and raising events. Is it just me, or is this not just subs dressed up as something else? I...
30
by: Burkhard | last post by:
Hi, I am new to C# (with long year experience in C++) and I am a bit confused by the language construct of events. What is it I can do with events that I cannot do with delegates? At the moment...
5
by: Richard Maher | last post by:
Hi, Here I mean "User" in the Programmer or Javascript sense. I merely wish to programmatically trigger an Event. It would be absolutely fantastic if there was a (Form level?) ONUSEREVENT() and...
14
by: xoozlez | last post by:
Hi there, I have a registration form where I like to filter out the past events of 2007. This is the code I am using : strSQL = "SELECT EventID, EventName, EventDateBegin, EventDateEnd,...
1
by: swethak | last post by:
Hi, I am desiging the calendar application for that purpose i used the below code. But it is for only displys calendar. And also i want to add the events to calendar. In that code displys the...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.