Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: Open window

  1. #1
    Regular Coder feras_wilson's Avatar
    Join Date
    Jul 2005
    Location
    Sweden
    Posts
    129
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question Open window

    Hi!
    i have a textbox and i have a link and i want when i click on link a new window is coming up with the value of the box.
    How i do????

    Please Help!

  • #2
    Regular Coder martin_narg's Avatar
    Join Date
    Jul 2002
    Location
    Chamonix, France
    Posts
    600
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Here's an example to help you get started

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Untitled Document</title>
    </head>
    
    <body>
    <form name="frm">
    <input type="text" name="txt">
    </form>
    <br>
    <a href="#" onclick="alert(document.frm.txt.value);return false;">alert the contents of the text box</a>
    </body>
    </html>
    Hope this helps

    m_n
    "Cos it's strange isn't it. You stand in the middle of a library and go 'Aaaaaaaaaaaaaaaaggggggghhhhhhh!'
    and everybody just stares at you. But you do the same in an aeroplane, and everybody joins in."
    -Tommy Cooper

  • #3
    Regular Coder feras_wilson's Avatar
    Join Date
    Jul 2005
    Location
    Sweden
    Posts
    129
    Thanks
    1
    Thanked 0 Times in 0 Posts

    New Window

    But i mean in new window

  • #4
    Regular Coder martin_narg's Avatar
    Join Date
    Jul 2002
    Location
    Chamonix, France
    Posts
    600
    Thanks
    1
    Thanked 3 Times in 3 Posts
    This will work, although it's very limited - depending on what you are trying to do there are other and better ways to do this.

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Untitled Document</title>
    <script type="text/javascript">
    function newWin(str) {
    	var html = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\
    	<html>\
    	<head>\
    	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">\
    	<title>'+str+'</title>\
    	</head>\
    	<body>\
    	'+str+'\
    	</body>\
    	</html>\
    	';
    	var win = window.open();
    	win.document.open();
    	win.document.write(html);
    	win.document.close();
    	win.focus();
    }
    </script>
    </head>
    
    <body>
    <form name="frm">
    <input type="text" name="txt">
    </form>
    <br>
    <a href="#" onclick="newWin(document.frm.txt.value);return false;">new window with contents of the text box</a>
    </body>
    </html>
    Hope this helps - if you could post up what you are trying to achieve, then it will be easier to provide a better solution.

    m_n
    "Cos it's strange isn't it. You stand in the middle of a library and go 'Aaaaaaaaaaaaaaaaggggggghhhhhhh!'
    and everybody just stares at you. But you do the same in an aeroplane, and everybody joins in."
    -Tommy Cooper


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •