Questions tagged [setattribute]

434 questions
5
votes
2 answers

Internet Explorer "setAttribute" onclick workaround?

var tr = document.createElement('tr'); tr.setAttribute("onclick",p.onrowclick+"("+row.id+")"); Hi, the above works fine for me in Firefox. I can't find the correct syntax for a workaround in IE. I'm using IE8.
StuR
  • 12,042
  • 9
  • 45
  • 66
5
votes
1 answer

Insert created element at start of html tag using PHP DOM

I'm trying to insert an HTML tag immediately after the opening tag of a page using dom. I've tried using appendChild which just inserts it before the which is no good. Code im using: $head =…
DrShamoon
  • 465
  • 6
  • 11
5
votes
4 answers

How to add parameters onto function in setAttribute() method in javascript

In javascript, I was creating new image tags and I was adding attributes to them with the setAttribute() method but I found that if I add an onclick event and add a function, I can't set in a parameter for it as seen below count = 0; //Will be the…
user3450498
  • 267
  • 1
  • 5
  • 13
5
votes
5 answers

Setting Namespace Attributes on an Element

I'm trying to create an XML document in Java that contains the following Element: I know how to create the…
Paul Reiners
  • 8,576
  • 33
  • 117
  • 202
4
votes
6 answers

Why can't I disable this XUL menuitem?

I'm at my wits end, and it's probably something really simple. Basically I've have got this code: var menuitem = document.getElementById('mymenuitem'); alert(menuitem); alert(varImChecking == null); menuitem.setAttribute('disabled', (varImChecking…
mrdrbob
  • 704
  • 1
  • 7
  • 14
4
votes
1 answer

How do I insert new attributes dynamically to xml tags using javascript?

I have some xml like the following: Track ID 4896 Name Let 'cha Boy Go (DIRTY) F/B.o.B Artist 4-Ize
Amen
  • 713
  • 4
  • 15
  • 28
4
votes
3 answers

Webbrowser SetAttribute not working (Password Field)

tried to write a program which logs me in automatically in a webbrowser in c#. This is the code i use at the moment for this purpose: HtmlElementCollection pageTextElements = loginBrowser.Document.GetElementsByTagName("input"); foreach…
Omegavirus
  • 277
  • 4
  • 16
4
votes
6 answers

Python setattr() can't find attribute that obviously exists

I'm at my wits end. Can't find anything else that helps with this. dta = {'type': "", 'content': ""} print dta >>>{'content': '', 'type': ''} setattr(dta, 'type', "Steve") >>>AttributeError: 'dict' object has no attribute 'type'
Steve
  • 905
  • 1
  • 8
  • 32
4
votes
2 answers

Javascript setattribute - name and value not work

When I implement this code - the name of the checkbox wont show up in the browser alongside the checkbox - just the checkbox itself. whats the reason for this? Am I using the setattribute-function incorrectly?