TAG Open in a new window and/or tab

P

Paulo

I have my page www.techna.pt almost ready nbut there re a few links i would
like to put (as default) opening in a new window (somethink like _Blank in
HTML code)
It can be done??
Thanks!
 
P

Paulo

Well, Thanks for the answer. I was able to make it work wit HTML code, but
is a mess to align the text.
I tried to use the ECMAS Script but it doesn't work. May be someone can tell
me in other words because my English is just ok, but not great. I am
Portuguese. Thank you very much!
 
D

DavidF

Getting the ECMAScript code to work correctly can be a bit tricky, but once
you get it working it is probably a better way. Perhaps part of the problem
is that English is not your first language, so let me explain in more
detail.

Reference:
http://office.microsoft.com/en-us/publisher/HA011587451033.aspx

Under the ECMAScript code approach, look at item 2. This first
javascript code snippet is incorrect on the website. Instead of:


<script language="JavaScript" type="text/javascript"> <!-- function
Show(Url, Name, Features) { window.open(Url, Name, Features); } // -->
</script>


Copy and paste the following into a code fragment box instead:


<script language="JavaScript" type="text/javascript">function Show(Url,
Name, Features) { window.open(Url, Name, Features); }</script>


Move that code fragment box into an area on your page where it won't get in
the way.

Now then I would suggest that you create a text box and drag it off into
your scratch area (the gray area around your working page), and use this
text box to create and write your link codes. Set the font to Courier. It is
really easy to miss a space, a " or something else in the code snippet, so
having one code snippet that does work to use as a "template" for other
links helped me make less errors. Once you build your link in the text box,
then you can just copy and paste it into the hyperlink dialog. Also start
off with a simple "open in a new window" link. Here is one that will work:


javascript:Show('http://www.google.com/','newwindow','')


Just change out "google.com" with the URL of the site that you want to open
in a new window. Then copy that line of script, select the text that you
want to hyperlink, right click, hyperlink, and just hit Ctrl + V to paste
the line of script into the address field. Then do a web page preview and
and test the link. Now once you have one working, you can just go back to
that "template" script and paste in other URLs and easily copy and paste
into the hyperlink dialog.

After you get just the open new window functioning, then you can go back and
start adding and changing the features or attributes of the new browser
window. Just add one feature/attribute at a time, and test as you go. Like I
said, it is really easy to make a mistake.

Hope these added instructions will help.

DavidF
 
M

Mike Koewler

David,

A question. Why use javascript instead of a simple link:

<a href='http://stjamesotv.com' target='_blank'>My Page</a>
in a code fragment? (Change the single quotes to double quotes)

Mike
 
D

DavidF

Hi Mike,

That is one of the two methods discussed in the article, and the method the
OP has been able to make work. There are times when it would be the best
choice...perhaps if you were adding just one "read more" link and putting
that code fragment box right after a text box, or something like that.
However, the javascript method allows the user to insert a hyperlink that
will open the new window by inserting the hyperlink in a word in an existing
text box just it is normally done. You can't use the code fragment method
you suggest to insert a hyperlink in an word in an existing text box. And
for what its worth, the code fragment method as written would take on the
default font format of the page for the text "My Page", which may or may not
be the preferred font or preferred size. So you would have to add font
formatting and font sizing code to the code fragment to get something other
than the default font and font size. Does that answer the question?

DavidF
 
M

Mike Koewler

David,

Totally and completely!

Mike
Hi Mike,

That is one of the two methods discussed in the article, and the method the
OP has been able to make work. There are times when it would be the best
choice...perhaps if you were adding just one "read more" link and putting
that code fragment box right after a text box, or something like that.
However, the javascript method allows the user to insert a hyperlink that
will open the new window by inserting the hyperlink in a word in an existing
text box just it is normally done. You can't use the code fragment method
you suggest to insert a hyperlink in an word in an existing text box. And
for what its worth, the code fragment method as written would take on the
default font format of the page for the text "My Page", which may or may not
be the preferred font or preferred size. So you would have to add font
formatting and font sizing code to the code fragment to get something other
than the default font and font size. Does that answer the question?

DavidF
 

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

Top