Help - Search - Members - Calendar
Full Version: What's my code missing?
BleepingComputer.com > Internet & Networking > Web Site Development
   
DnDer
CODE
How does a <a href='http://intranet/FAQS/[FAQ item].htm' onclick="return new_window('http://intranet/FAQS/[FAQ item].htm');" target="test">[FAQ Item]</a> work?


I copied and pasted, then used the new link. I don't know how to Javascript. I'd like this window to fit all the text inside. (The original did. But it was also a much shorter block of text.) What variables do I need to put in there to do this?
Andrew
Try this instead:

CODE
<a href="java script:window.open('foo.html', 'MyPopup', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=50
0,height=250,left = 470,top = 325');">Foo</a>

Note: remove the space between java and script to make this work.

Where foo.html is the page to be opened, MyPopup can be any string and the parameters toolbar, scrollbars, location, statusbar, menubar, and resizable are booleans (0 = turn that feature off, 1 = turn that feature on), width and height control the size in pixels of the window, and left and top control its position in pixels relative to the top and left edges of the screen.

All the parameters but the first two are optional.

Be warned: this method if user interface design is largely depreciated and considered bad design. Many modern browsers enable the user to override or disable the controls and restrictions available to the developer in this case. For example, Firefox can be set to ignore the parameter=0 restriction and even to force such windows to open in a new tab instead of a popup.
DnDer
It's just something that's quick and dirty for our intranet for the company, and serves its purpose.

Now, what I am interested in is can you set it so that the window opens to the size of the text, assuming the length of the text is less than the height of the screen, of course...
groovicus
QUOTE
Now, what I am interested in is can you set it so that the window opens to the size of the text, assuming the length of the text is less than the height of the screen, of course...
The short answer is no. The long answer is yes, but it would be incredibly complex, and not something that someone who does not "know how to javascript" is going to accomplish. The problem is that unless you know for sure that the text is going to be a certain font, of certain size, and of certain length, then you can't assume anything at all.
DnDer
Thanks for that! I'll just have to experiment with which "height" works.

Also... how do you "casually" mention something like labor pains? XD
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.