Click to See Complete Forum and Search --> : Open new window from TEXTAREA variable


stu
11-26-2003, 12:30 PM
Hi.

I have a textarea that is populated by a variable in the form of a URL. I wish to have a button next to the textarea which, when clicked will open the appropriate URL link in a new window, dependant on which variable is sent to the textarea. Can this be done, if so can you tell me how, please.

many thanks, Stu

Nevermore
11-26-2003, 03:39 PM
I assume you mean that the URL is typed into the text box, and the button is a 'go' buton? (What's the point, BTW, when all browsers have 1 anyway)

<input type="button" onclick="window.location.href=document.getElementById('textbox_id').value;" value="Go!">

stu
11-27-2003, 10:52 AM
Many thanks. This worked fine.

The idea wasn't for a textarea to act like an address bar, it was simply that a variable was passed to the textarea (not manually typed in), and from here, they could visit that URL rather than copy/pasting it into their own address bar.

Many thanks for your help,

Regards
Stu