Mac Widget javascript

trainguy77

macrumors 68040
Original poster
Nov 13, 2003
3,571
1
How do you put text into a browser. So in a widget i press a button and it will inserts text into a spot on a open webpage? Is this possible?

Thanks
 

ehwizard

macrumors newbie
Jan 28, 2003
16
0
New York, NY
You could do something like this...


<div id='foo'></div>

<script>
document.getElementById("foo").innerHTML = "hi";
</script>

Is that what you mean?
 

trainguy77

macrumors 68040
Original poster
Nov 13, 2003
3,571
1
ehwizard said:
You could do something like this...


<div id='foo'></div>

<script>
document.getElementById("foo").innerHTML = "hi";
</script>

Is that what you mean?
So i would put this in a widget then when it is run it would put "hi" into the ID "foo" of the webpage?
 

trainguy77

macrumors 68040
Original poster
Nov 13, 2003
3,571
1
Yes, but will that same line work if it is in widget putting code into the webpage? Will it just put it into the active window?
 

trainguy77

macrumors 68040
Original poster
Nov 13, 2003
3,571
1
I will explain, a thread came up that mentioned have a widget running on dashboard that could insert, the noob answers into these forums. (of coarse never spamming) It would be able to have a button for like connecting Macs and PCs that kind of thing. This would save time answering the basic questions. More then anything, I just want to know more about making widgets.


(By the way I would never distribute it without permission from the mods!)