Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OnClick and CF 1

Status
Not open for further replies.

varnix

Programmer
Joined
Jan 7, 2002
Messages
94
Location
US
I have a CF page that I need the generated link to open in a smaller window. I am trying to use the "onclick" and "window.open" commands to create this new window.

But so far all of my efforts have not worked quite right.

Any suggestions are appreciated.
 
your code should look something like this, I am using a button here but the same could be done on a link

<input type=&quot;button&quot; onClick=&quot;javascript:window.open('pageToopen')&quot;>

this is one way but i normally use something like this as it is more customizable:

<html>
<head>
<title>open window</title>
<script language=&quot;javascript&quot;>
<!--
var desktop;
function openWindow(url,w,h){
if (desktop && desktop.location) desktop.close();
desktop = window.open(url, &quot;_blank&quot;,&quot;toolbar=0,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=1,width=&quot;+w+&quot;,height=&quot;+h);
}

//-->
</script>
</head>

<body>

<a href=&quot;javascript:openWindow('yourpagehere','width','height')&quot;>Open a window</A>

</body>
</html>

this uses a bit of javascript (openWindow function) that i pass three params to (page to open, width of window, height of window) when the link is clicked the page will open with the various options that you set in the function (scrollbars, menus etc) at the moment they are set to being on (1=on !)

hope this helps !
 
Worked like a charm!

Specifically the method using the href=&quot;javascript:&quot;.

None of my users really seem to grasp that they can click on a button.

Thanks again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top