I use
mycurrent_cell. setAttribute("s tyle", "background-color:green");
and
mycurrent_cell. setAttribute("c olspan", "3");
to set some attributes of a table. The code works perfect in FireFox and
Opera, but in IE the table looks like those properties haven't been set.
When I use the 'view generated source' (from webdevelopers toolbar in FF)
and I use that to create a static html-page, it looks OK in IE. I've checked
but the setAttribute is recognized by IE, but maybe there is a problem with
the setAttribute when used for a <td> or <th> ?
If necessary I can post complete code.
Pugi! 6 8070
Pugi! wrote: mycurrent_cell. setAttribute("s tyle", "background-color:green"); mycurrent_cell. setAttribute("c olspan", "3"); to set some attributes of a table. The code works perfect in FireFox and Opera, but in IE the table looks like those properties haven't been set.
IE has quite a lot of bugs, I didn't tested these two lines above and I
won't do it now hehe. Anyway, in my opinion it should work, try to set
through JavaScript to see if it works ;)
cell.style.back groundColor = "green";
cell.colSpan = 3;
But maybe you're right, since there's a problem with the class property,
when you set through setAttribute on IE it doesn't reflect your changes,
it does only if you set using "object.classNa me = 'lala'";
If necessary I can post complete code.
Post an URL, with the minimun code to generate the problem. If you post
a big code here, nobody will read :)
--
Jonas Raoni Soares Silva http://www.jsfromhell.com
"Jonas Raoni" <jo********@gma il.com> schreef in bericht
news:dt******** **@emma.aioe.or g... Pugi! wrote: mycurrent_cell. setAttribute("s tyle", "background-color:green"); mycurrent_cell. setAttribute("c olspan", "3"); to set some attributes of a table. The code works perfect in FireFox and Opera, but in IE the table looks like those properties haven't been set.
IE has quite a lot of bugs, I didn't tested these two lines above and I won't do it now hehe. Anyway, in my opinion it should work, try to set through JavaScript to see if it works ;)
cell.style.back groundColor = "green"; cell.colSpan = 3;
But maybe you're right, since there's a problem with the class property, when you set through setAttribute on IE it doesn't reflect your changes, it does only if you set using "object.classNa me = 'lala'";
If necessary I can post complete code.
Post an URL, with the minimun code to generate the problem. If you post a big code here, nobody will read :)
-- Jonas Raoni Soares Silva http://www.jsfromhell.com
Thanks,
The cell.style.back groundColor ... and cell.colSpan work great. I wonder is
there a way to test/detect that a browser doesn't support the setAttribute
method ? I am learning DOM & Javascript and it is thaught it is not done to
test for a browser but to test if a property, method, object , ... is valid
(if (window.ActiveX Object) {...}).
Pugi!
"Pugi!" <re***@group.be > schreef in bericht
news:eK******** ************@sc arlet.biz... "Jonas Raoni" <jo********@gma il.com> schreef in bericht news:dt******** **@emma.aioe.or g... Pugi! wrote: mycurrent_cell. setAttribute("s tyle", "background-color:green"); mycurrent_cell. setAttribute("c olspan", "3"); to set some attributes of a table. The code works perfect in FireFox and Opera, but in IE the table looks like those properties haven't been set.
IE has quite a lot of bugs, I didn't tested these two lines above and I won't do it now hehe. Anyway, in my opinion it should work, try to set through JavaScript to see if it works ;)
cell.style.back groundColor = "green"; cell.colSpan = 3;
But maybe you're right, since there's a problem with the class property, when you set through setAttribute on IE it doesn't reflect your changes, it does only if you set using "object.classNa me = 'lala'";
If necessary I can post complete code.
Post an URL, with the minimun code to generate the problem. If you post a big code here, nobody will read :)
-- Jonas Raoni Soares Silva http://www.jsfromhell.com
Thanks,
The cell.style.back groundColor ... and cell.colSpan work great. I wonder is there a way to test/detect that a browser doesn't support the setAttribute method ? I am learning DOM & Javascript and it is thaught it is not done to test for a browser but to test if a property, method, object , ... is valid (if (window.ActiveX Object) {...}).
Pugi!
IE supports the setAttribute for a table, but not for a cell (td or th).
So I guess I will have to work with cell.style.back groundColor, ... to set
properties for a <td> or <th>-tag.
Pugi!
On 24/02/2006 20:35, Pugi! wrote: "Jonas Raoni" <jo********@gma il.com> schreef in bericht news:dt******** **@emma.aioe.or g...
[snip] But maybe you're right, since there's a problem with the class property, when you set through setAttribute on IE it doesn't reflect your changes, it does only if you set using "object.classNa me = 'lala'";
One has to pass 'className' to the setAttribute method for IE to
recognise it. Yes, I know: stupid.
[snip]
I wonder is there a way to test/detect that a browser doesn't support the setAttribute method ?
Just avoid it. As far as I know, all HTML attributes and CSS properties
can be accessed using the shortcut properties.
If a document is served as XHTML (that is, with an application/xhtml+xml
MIME type) the situation is different, but then IE doesn't support
XHTML, anyway.
I am learning DOM & Javascript and it is thaught it is not done to test for a browser but to test if a property, method, object , ... is valid
Yes, but as IE does implement the *Attribute methods, a test would need
to be more complicated than that. Besides, what would you do if the test
failed? Use the shortcut properties, no doubt, so you might as well do
that from the outset.
(if (window.ActiveX Object) {...}).
A rather random example. It certain has no relevance here.
Mike
--
Michael Winter
Prefix subject with [News] before replying by e-mail.
Pugi! wrote: IE supports the setAttribute for a table, but not for a cell (td or th). So I guess I will have to work with cell.style.back groundColor, ... to set properties for a <td> or <th>-tag.
I don't know about you, but I always preffer to use the built-in
JavaScript stuffs.
Instead of:
select.appendCh ild(document.cr eateElement("op tion")).text = "Jonas";
I preffer:
select.options. add(new Option("Jonas", ""));
--
Jonas Raoni Soares Silva http://www.jsfromhell.com
"So I guess I will have to work with cell.style.back groundColor"
well... whats wrong with that? its easier to use, faster and less
complicated, so rather than "having to" you "are luckily allowed to"
:-))) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: timmy_dale12 |
last post by:
Hello , im a java programmer whos gotten tangled up in some
javascripts. Im really stuck on this one can , can aybody explain this
to me.
I have a javscript which is to clone a table row and insert it below
the current table row. this is the main part :
// New row function. Called by form button.
function newRow(baseRowId, tableId) {
|
by: mitch |
last post by:
Suppose I have a DOM element, say a td, and I want to add a
value to it to be used later. I am unclear on when it's OK to do
td.myAttr = "hello";
versus when I need to do
td.setAttribute("myAttr", "hello");
Could somebody explain the difference between these two?
|
by: James Black |
last post by:
I am curious if there is a benefit to set attributes directly, in my
javascript, or to use setAttribute.
For example, I have this:
var input = document.createElementNS(xhtmlNS, 'input');
input.setAttribute('width', '20em');
I could have just called input.width='20em'
When is each better to use, or is there no difference between them?
|
by: J |
last post by:
I am having problems dynamically adding more than one event handler to
an input. I have tried the Javascript included at the bottom. The
lines
inp.attachEvent('onkeyup', makeEventFunc1(strand));
inp.attachEvent('onchange', makeEventFunc2(strand));
individually work in IE, but when used together, only the bottom one
remains active.
I have also tried
|
by: jesdynf |
last post by:
I'm having trouble applying a stylesheet to content I'm generating
after the fact.
Here's the sample code:
<html>
<head>
<title>CSS/DOM Problem Example</title>
<style type="text/css">
..historylinks {
| |
by: Aaron Gray |
last post by:
Whats going on with setAttribute on IE it appears to work on some examples
and working code but not on other code that I am writting ?
<style>
.foo {
font-size: 200%;
}
</style>
|
by: vaibhav03 |
last post by:
Hello All,
I have made an AJAX call and bringing back some data from the server and then That data would be converted to XML through javascript. Now i am creating various elements like TABLE, TR, TD, Anchor to render that data using createElement method. and also i have to set some Usual and custom attributes to those elements and then render it on page.
Now my problem is when i use element.setAttribute(name, value) in a loop then after...
|
by: nygiantswin2005 |
last post by:
Hi
I have wrote a method in my C# class with the following code, to
create an XMl file.
The root element is suppose to have 3 attibutes. I can not get
attributes to appear correctly.
XmlDocument document = new XmlDocument();
|
by: Sri02 |
last post by:
All,
I was trying to add an onclick event using setAttribute to a <tdfrom
javascript. Apparently the code doesnot seem to work in FF3 but works
pretty well in IE7.
Here is the snippet for ur reference:
<...
var _table=document.createElement("table");
_tbody=document.createElement("tbody");
|
by: maminx |
last post by:
hello all, i have this script below
var td = document.createElement('td');
var theInput = document.createElement('input');
theInput.setAttribute('type', 'text');
theInput.setAttribute('name', 'codcnourut');
theInput.setAttribute('size', '3');
theInput.setAttribute('value',form.codcnourut.value);
theInput.setAttribute('readonly','true');
td.appendChild(theInput);
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |