views:

52

answers:

3

I want something that the webmaster can copy into his site.

It just needs to have my logo, a text box, and a submit button. (When the user clicks submit using that widget, it forwards to my site.)

I know there are many ways to do this. What is the fastest and easiest?

+1  A: 

I don't know about fastest and easiest, but maybe you could write a little JavaScript file that creates and injects the content into a div with a special ID.

This is along the lines of what StackOverflow does for their "flair."

Cory Larson
+1  A: 

Fastest way is to just put some HTML code that people can paste in their page. There's no need for buttons or form, just a simple link.

Something on the lines of:

<a href="http://www.yoursite.com/"&gt;
<img src="http://www.yoursite.com/yourlogo.jpg" alt="yoursite.com logo" title="Visit yoursite.com!" />
</a>

You'll probably want to add a couple of style tags (e.g to avoid borders around the image etc) Also, it would be easy on your site to have a little JS that changes the code above so that people can personalize it (point to different images, different sizes etc etc)

nico
Note that the questioner wants a text box and a submit button.
Kristopher Johnson
@Kristopher Johnson: I know, but I don't really see the point in using a submit button when the only action taken is to open his website. Forms are for transmitting data, anchors are for linking to a page. Anyway the solution holds even if he puts a `<button>` instead of an `<a>`.
nico
+1  A: 

Some may frown upon it but possibly the fastest and easiest way is to use an iframe. It means that the embed code can be quite short + you can change the behaviour at a later date.

Iframe's main advantage is that you don't have to deal with the css that's already included in the page. Might not seem like a big deal but sooner or later you'll run into a page that does something with a css attribute that you just hadn't expected.

It's not pretty but it's worth considering.

Aidan Kane