javascript

hi,
i want to create a script in which if user clicks on any text box area then automatically new url should open.
can anyone knows that code?

thank you .
LVL 10
d4durveshAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

plusone3055Commented:
http://www.pageresource.com/jscript/jwinopen.htm

<FORM>
<INPUT type="button" value="New Window!" onClick="window.open('http://www.pageresource.com/jscript/jex5.htm','mywindow','width=400,height=200')">
</FORM>

can use the same code in a textbox instead of a button
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
nap0leonCommented:
In case plusone3055's post wasn't clear... all you need to do is add the onclick atttribute to your textbox:

onclick="window.open('http://www.pageresource.com/jscript/jex5.htm','mywindow','width=400,height=200')"

If you want this to also happen if someone tabs into the field, you may instead want to use "onfocus" rather than "onclick".
0
d4durveshAuthor Commented:
hi, i thanx both of you for your kind replay's.

yes it is working when i tried onclick attribute but not when i use onfocus . it shows that firefox is preveting to open a new pop-up box.

any idea why it showing that??
0
nap0leonCommented:
Firefox's pop-up blocker is preventing the pop-up because, well, that's what it is supposed to do.

For onfocus - you probably don't want to do that anyway... use a browser that lets the popup work... watch what happens when you click the popup - you'll get two (one for the onfocus and one for the onclick) - watch what happens when you close the last popup... you'll get another popup (because that box/button/etc has now regained focus).
0
d4durveshAuthor Commented:
thanx both of you. :-) good day tc
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.