BleepingComputer.com: What's my code missing?

Jump to content


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.

Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

What's my code missing? New Javascript window needs to be bigger

#1 User is offline   DnDer 

  • Senior Member
  • PipPipPipPip
  • Find Topics
  • Group: Members
  • Posts: 552
  • Joined: 25-October 08

Posted 25 August 2009 - 10:04 AM

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?

#2 User is offline   Andrew 

  • Bleepin' Night Watchman
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Moderator
  • Posts: 7,329
  • Joined: 05-December 05
  • Gender:Not Telling
  • Location:Right behind you

Posted 25 August 2009 - 12:57 PM

Try this instead:

<a href="java script:window.open('foo.html', 'MyPopup', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,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.

This post has been edited by Amazing Andrew: 25 August 2009 - 12:58 PM

Help us help you. If HelpBot replies, you MUST follow step 1 in its reply so we know you need help.
Posted Image
Boredom Software Stop Highlighting Things

#3 User is offline   DnDer 

  • Senior Member
  • PipPipPipPip
  • Find Topics
  • Group: Members
  • Posts: 552
  • Joined: 25-October 08

Posted 25 August 2009 - 02:11 PM

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

#4 User is offline   groovicus 

  • Hail Groovicus!
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Moderator
  • Posts: 9,522
  • Joined: 05-June 04
  • Gender:Male
  • Location:Centerville, SD

Posted 25 August 2009 - 02:41 PM

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.
"Take the risk of thinking for yourself, much more happiness, truth, beauty, and wisdom will come to you that way" - Christopher Hitchens

#5 User is offline   DnDer 

  • Senior Member
  • PipPipPipPip
  • Find Topics
  • Group: Members
  • Posts: 552
  • Joined: 25-October 08

Posted 25 August 2009 - 02:43 PM

Thanks for that! I'll just have to experiment with which "height" works.

Also... how do you "casually" mention something like labor pains? XD

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users