Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
Opening a new window from a text box
Old 11-01-2004, 03:01 PM Opening a new window from a text box
Spud In Disguise's Avatar
Super Spam Talker

Posts: 808
Location: UK... where else?
Trades: 0
Hey. How would I go about creating this:

I want on a page on one of my sites to have a text box (or similar) that my guests can type an address into, then they can lick a button next to it and the address they types in will be opened in a new browser window. How do I do this?

Thanks!
__________________

Please login or register to view this content. Registration is FREE
- Fansite

Please login or register to view this content. Registration is FREE
- Blog
Spud In Disguise is offline
Reply With Quote
View Public Profile Visit Spud In Disguise's homepage!
 
 
Register now for full access!
Old 11-01-2004, 04:36 PM
Minaki's Avatar
Defies a Status

Posts: 1,626
Location: Guildford, UK
Trades: 0
One way is:
HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Address Demo</title>
<script type="text/javascript">
<!--
 function doGo() {
  Url = document.frmAddr.txtAddress.value
  window.open(Url, 'NewWindow', 'location=1,menubar=1,resizeable=1,scrollbars=1,status=1,toolbar=1');
 }
-->
</script>
</head>
<body>
 <form id="frmAddr" name="frmAddr" action="">
  <div>
   <input type="text" name="txtAddress" id="txtAddress" />
   <input type="button" name="cmdGo" id="cmdGo" value="Go" onclick="javascript:doGo();" />
  </div>
 </form>
</body>
</html>
Might need a bit of tweaking/fixing. I can tell you it's XHTML Compliant, but I can't guarantee my javascript will work :-P
__________________
Minaki Serinde MCP
"Wow, Linux is nearly on-par with Windows ME!"

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Minaki is offline
Reply With Quote
View Public Profile Visit Minaki's homepage!
 
Old 11-01-2004, 04:46 PM
Spud In Disguise's Avatar
Super Spam Talker

Posts: 808
Location: UK... where else?
Trades: 0
Yay!!!! That works fine! Just two things... How do I make it so that the 'http://' bit is already in the text box and when the user clicks inside the box it stays there,

and also how do I set it so that once an address is typed if the 'enter' key is pressed it has the same effect as the go button?

But excellent work!!! Thank you so much!
__________________

Please login or register to view this content. Registration is FREE
- Fansite

Please login or register to view this content. Registration is FREE
- Blog
Spud In Disguise is offline
Reply With Quote
View Public Profile Visit Spud In Disguise's homepage!
 
Old 11-01-2004, 06:53 PM
foobar's Avatar
Extreme Talker

Posts: 225
Trades: 0
To make "http://" appear already ...

Change
HTML Code:
<input type="text" name="txtAddress" id="txtAddress" />
for ..

HTML Code:
<input type="text" name="txtAddress" id="txtAddress" value="http://" />
As for the "Enter" part, I have an idea, but I'm sure someone will come up with something better .
foobar is offline
Reply With Quote
View Public Profile Visit foobar's homepage!
 
Old 11-02-2004, 03:32 AM
Ultra Talker

Posts: 377
Trades: 0
Well, you may highlight your button (usually it's highlighted by default) so you just have to press "Enter". Or there is some way to set a "hot key" for a button trough <accesskey>
__________________
andrews_john

Please login or register to view this content. Registration is FREE
andrews_john is offline
Reply With Quote
View Public Profile Visit andrews_john's homepage!
 
Old 11-02-2004, 06:06 AM
nick89's Avatar
Super Talker

Posts: 136
Location: Brisbane, Australia
Trades: 0
PHP Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Address Demo</title>
<
script type="text/javascript">
 <!-- 
function 
doGo() { 
var 
Url;
Url document.frmAddr.txtAddress.value;
window.open(Url'NewWindow''location=1,menubar=1,resizeable=1,scrollbars=1,status=1,toolbar=1');
function 
keyGo{
var 
Url;
  if(
event.which == 10){
    
Url document.frmAddr.txtAddress.value;
    
window.open(Url'NewWindow''location=1,menubar=1,resizeable=1,scrollbars=1,status=1,toolbar=1');
  }
}
 } --> 
</script> 
</head><body>
<form id="frmAddr" name="frmAddr" action="">
<div> <input type="text" name="txtAddress" id="txtAddress" />
<input type="button" name="cmdGo" id="cmdGo" value="Go" onclick="javascript:doGo();" onkeypress="javascript:keyGo();" />  </div>  </form> </body> </html> 
nick89 is offline
Reply With Quote
View Public Profile Visit nick89's homepage!
 
Old 11-26-2004, 03:24 PM
Spud In Disguise's Avatar
Super Spam Talker

Posts: 808
Location: UK... where else?
Trades: 0
Just noticed something with the JavaScript one:

the window that opens is non-resizeable... any thoughts?
__________________

Please login or register to view this content. Registration is FREE
- Fansite

Please login or register to view this content. Registration is FREE
- Blog
Spud In Disguise is offline
Reply With Quote
View Public Profile Visit Spud In Disguise's homepage!
 
Reply     « Reply to Opening a new window from a text box
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.34127 seconds with 12 queries