View Full Version : Widget javascript
trainguy77
Jun 22, 2005, 04:25 PM
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
Jun 22, 2005, 06:52 PM
You could do something like this...
<div id='foo'></div>
<script>
document.getElementById("foo").innerHTML = "hi";
</script>
Is that what you mean?
trainguy77
Jun 22, 2005, 09:45 PM
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?
ehwizard
Jun 22, 2005, 09:50 PM
Yeah.
Take a look at: http://www.zete.org/people/ehorowitz/sample.html
View the source of the page and see the result.
trainguy77
Jun 23, 2005, 04:08 PM
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?
ehwizard
Jun 23, 2005, 04:16 PM
What webpage?
You mean you want a safari widget to insert code into a webpage open in Safari?
trainguy77
Jun 23, 2005, 04:49 PM
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!)
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.