Starting a second window

C

Cogito

On a web page I describe a puzzle and would like to have the word
'Solution' as a hyperlink that will start a small window (on top of
the previous screen) showing the solution page. What is the code for
this?
 
S

Steve R.

Cogito wrote in message ...
On a web page I describe a puzzle and would like to have the word
'Solution' as a hyperlink that will start a small window.

Try this markup below. Change the width and height figures to suit the size
ot the window you wish to open.

Copy it to notepad and save it as 'new_window.htm' (or whatever), then try
it to make modifications as you require.

<html>
<head>
<title></title>

<script language="JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
</head>

<body>

<a href="javascript:;"
onClick="MM_openBrWindow('YOUR_HTM_PAGE_URL','','width=400,height=300')">So
lution</a>

</body>
</html>
 
L

Leif K-Brooks

Cogito said:
On a web page I describe a puzzle and would like to have the word
'Solution' as a hyperlink that will start a small window (on top of
the previous screen) showing the solution page. What is the code for
this?

It's my browser window, not yours. Just have a normal link.
 
C

Cogito

Cogito wrote in message ...

Try this markup below. Change the width and height figures to suit the size
ot the window you wish to open.

Copy it to notepad and save it as 'new_window.htm' (or whatever), then try
it to make modifications as you require.

<html>
<head>
<title></title>

<script language="JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
</head>

<body>

<a href="javascript:;"
onClick="MM_openBrWindow('YOUR_HTM_PAGE_URL','','width=400,height=300')">So
lution</a>

</body>
</html>

Thank you very much.
 
S

Steve R.

Leif K-Brooks wrote in message ...
It's my browser window, not yours. Just have a normal link.

There are exceptions to that rule and in this case it was a good idea to
have a small *requested* pop-up window as a solution.
 
C

Cogito

Cogito wrote in message ...

Try this markup below. Change the width and height figures to suit the size
ot the window you wish to open.

Copy it to notepad and save it as 'new_window.htm' (or whatever), then try
it to make modifications as you require.

<html>
<head>
<title></title>

<script language="JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
</head>

<body>

<a href="javascript:;"
onClick="MM_openBrWindow('YOUR_HTM_PAGE_URL','','width=400,height=300')">So
lution</a>

</body>
</html>

When I click on the Solution link the status bar shows only
javascript:;
and nothing opens... is there a comma or somthing else missing
somewhere?
 
S

Steve R.

Cogito wrote in message...
When I click on the Solution link the status bar shows only
javascript:;
and nothing opens... is there a comma or somthing else missing
somewhere?

Did you *copy and paste* it to notepad and save it as an htm file or did
you try and copy staright to a web-building program?

It's essential to copy to notepad first to remove the formatting from your
browser.

I've just tried it and it works ok. IE6.
 
D

DU

Steve said:
Cogito wrote in message ...



Try this markup below. Change the width and height figures to suit the size
ot the window you wish to open.

Copy it to notepad and save it as 'new_window.htm' (or whatever), then try
it to make modifications as you require.

<html>
<head>
<title></title>

<script language="JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
</head>

<body>

<a href="javascript:;"
onClick="MM_openBrWindow('YOUR_HTM_PAGE_URL','','width=400,height=300')">So
lution</a>

</body>
</html>

As coded, the requested popup will have no scrollbar(s) if needed: that
is, there will be no scrollbar(s) even if the content overflows
requested window dimensions. So, that popup has an usability flaw.
As coded, the requested popup will not be resizable: in no way, this can
promote usability and accessibility to the content.
As coded, clicking the *link* will not open the page at all if
javascript is disabled.
As coded, clicking the link will not disable the default action of the
link. So, after opening the window, browsers will try to execute
"javascript:;" and they won't succeed: the result will be that the popup
will lose focus and the user won't understand what happened.
As coded, clicking the link will not bring back focus to the requested
popup if it lost focus: this is a very frequent usability burden
encountered by coding popups.
As coded, if the user wants to open the link in a new tab (via
contextmenu of right-click), he will not succeed.
As coded, the properties of the link will only indicate "javascript:;"
as the link and will inform the user that the link will be opened in the
*same* window: so even the browser will be confused and will return a
false information.
As coded, the provided solution uses invalid markup code and will
interfere with users who wish to control how such link will be opened.

Most (if not all) of these difficulties, problems, burdens would have
been prevented by either coding the link to open a requested popup in a
thorough manner or by simply coding the link like a normal link, e.g.:

<a href="YOUR_HTM_PAGE_URL">Solution</a>

and letting the user use his contextmenu commands like he wishes.

DU
 
S

Steve R.

DU wrote in message ...
As coded, the requested popup will have no scrollbar(s) if needed: that
is, there will be no scrollbar(s) even if the content overflows
requested window dimensions. So, that popup has an usability flaw.

Look - If the *solution* to his puzzle ... whatever, is just one word or a
graphic, then a small pop-up window with the *solution* will be more than
adequate.

He's able to size the pop-up to fit his answer. The user is able to move
the pop-up around to compare the answer with the user's own efforts ...
easy.

Why do others have to make things so complicated when a simple answer
serves?

The OP hopefully knows what he's doing. Even if he doesn't, at least when
we see the final result we can critic.
 
M

Mark Parnell

He's able to size the pop-up to fit his answer. The user is able to move
the pop-up around to compare the answer with the user's own efforts ...
easy.

But how does he know how much room the answer will take at the user's
chosen font size?
Why do others have to make things so complicated when a simple answer
serves?

Because the answer promotes bad coding practices, and either won't work
at all or won't work properly for many people.
The OP hopefully knows what he's doing. Even if he doesn't, at least when
we see the final result we can critic.

In cases like this, chances are we wouldn't see the end result. The OP
would go away, find that it works for him/her and assume it will work
for everyone else.

Even if we were going to see the end result, surely it is better to get
the OP to do it right in the first place?
 
D

DU

Steve said:
DU wrote in message ...



Look - If the *solution* to his puzzle ... whatever, is just one word or a
graphic, then a small pop-up window with the *solution* will be more than
adequate.

As coded, *your code* will not work for 8% to 12% of all users out there
who have javascript support disabled. No word in a popup. No graphic in
a popup. Nothing. Zero. Nil.

There is such a thing as abusing user's system resources, you see. Popup
coding involves creating, building window frames, borders, toolbars,
size, positioning, security, memory management, storing and retrieving
persistent data, etc and popup code in browser executable involves lots
of instruction code, just in case you ignore this. So, if you're going
to suggest and support the popup approach, at the very least provide one
that meets usability standards, accessibility guidelines and respect as
much as possible user's system resources.
If the solution to his puzzle is just 1 word or a graphic, then a popup
is less justified and less justifiable as a solution.
He's able to size the pop-up to fit his answer.

As coded, *your code* will annoy the user if the user needs to resized
the popup, and this, for whatever reasons he would need/want to resize
such popup. Often web designers do not consider browser default margins
on the body element.
If you believe the popup is correctly sized, then why do you fear making
it resizable? What's the safe, cautious, flexible approach (from the
user's perspective) to sizing a popup? To make it rigid and unresizable
or to make it resizable?
Why people are requested help on this then?
"Unable to Maximize or Resize Internet Explorer Pop-Up Windows"
http://support.microsoft.com/default.aspx?scid=kb;en-us;211068

The user is able to move
the pop-up around to compare the answer with the user's own efforts ...
easy.

Why do others have to make things so complicated when a simple answer
serves?

This is what you wrote in the "Open in new window ??......." thread just
yesterday:
"if you suspect the link doesn't open in a new window
and you try the right-click option it still doesn't work if it's a
javascript link, so when you realise you just close it and do a *normal*
left-click."

Now, for someone speaking of simple answer, simple solution that works,
you certainly have your javascript understanding, explaining pretty
twisted. You're entirely contradicting yourself: your code and your
explanations are incoherent, inconsequent. You're coding a solution that
you know creates problems!

http://jibbering.com/faq/#FAQ4_24

"When they want the destination to appear in a new page, they can use
their browser's 'open in new window' command -- assuming, of course,
that **the link is not a piece of code that interferes with the
browser’s standard behavior.**"
Top Ten Web-Design Mistakes of 2002
6. JavaScript in Links
http://www.useit.com/alertbox/20021223.html

and that is exactly what the code you provided in this thread do.


" * Don't use javascript: URLs
Using a straight http: URL will allow any browser to access the
link. If you want to use JavaScript for browsers that have JavaScript
enabled, use the onMouseOver and onClick attributes of the <a href> tag.

(...)

* wrong:
<a href="javascript:window.open(blah)">
* right:
<a href="foo.html" target="_blank" onClick="window.open(blah);
return false">
"
http://www.panix.com/~aahz/javascript.html#remove

The OP hopefully knows what he's doing.

Anyone could copy and paste a DreamWeaver function code, you know,
without understanding its flaws, limitations, usability burden, without
justification for its implementation.

Even if he doesn't, at least when
we see the final result we can critic.

You provided a complete webpage code, from <html> to </html> in this
thread. And it had flaws and weaknesses that anyone could see and can
verify all by himself.

DU
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top