...

View Full Version : Open window



feras_wilson
08-14-2005, 02:58 PM
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???? :confused:

Please Help! :thumbsup:

martin_narg
08-14-2005, 03:03 PM
Here's an example to help you get started



<!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

feras_wilson
08-14-2005, 03:05 PM
But i mean in new window

martin_narg
08-14-2005, 03:13 PM
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.



<!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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum