Widget javascript

Discussion in 'Mac Programming' started by trainguy77, Jun 22, 2005.

  1. trainguy77 macrumors 68040

    Joined:
    Nov 13, 2003
    #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
     
  2. ehwizard macrumors newbie

    Joined:
    Jan 28, 2003
    Location:
    New York, NY
    #2
    You could do something like this...


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

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

    Is that what you mean?
     
  3. trainguy77 thread starter macrumors 68040

    Joined:
    Nov 13, 2003
    #3
    So i would put this in a widget then when it is run it would put "hi" into the ID "foo" of the webpage?
     
  4. ehwizard macrumors newbie

    Joined:
    Jan 28, 2003
    Location:
    New York, NY
  5. trainguy77 thread starter macrumors 68040

    Joined:
    Nov 13, 2003
    #5
    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?
     
  6. ehwizard macrumors newbie

    Joined:
    Jan 28, 2003
    Location:
    New York, NY
    #6
    What webpage?

    You mean you want a safari widget to insert code into a webpage open in Safari?
     
  7. trainguy77 thread starter macrumors 68040

    Joined:
    Nov 13, 2003
    #7
    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!)
     

Share This Page