2

I'm new to Mac OS X Dashboard developement. Now, I have a button with id b_start. When that button is clicked, I want the label of the button to change to "Round".

Now I have tried these, but none of them work:

document.getElementById("b_start").label = "Round";
document.getElementById("b_start").text = "Round";
document.getElementById("b_start").innerText = "Round";
document.getElementById("b_start").object.setValue("Round");
document.getElementById("b_start").value = "Round";

Does anyone how I can change the button's label?

sehe
  • 374,641
  • 47
  • 450
  • 633
  • Also, you are searching for the DOM element every time you set a property, that's bad –  Apr 21 '10 at 00:13

3 Answers3

1

I solved the question my own. Just use this:

document.getElementById("b_start").object.textElement.innerText = "Round";
  • The answer provided by Bob Villa is better: http://stackoverflow.com/questions/1238523/dashcode-newbie-question-change-a-buttons-label-programmatically/1241008#1241008 – MKroehnert Dec 25 '10 at 11:20
1

document.getElementById("b_start").object.setText("Round");

0
document.getElementById("b_start").object.setEnabled(false);
sra
  • 23,820
  • 7
  • 55
  • 89
Peter
  • 1