473,386 Members | 1,943 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How do I "convert" this to a "function"?

Probably the wrong wording but since I'm not a scripter I won't claim
to know what I'm talking about.

I got this script from www.htmlgoodies.com

<script language="JavaScript">
<!--
window.open ('photos01.html','photogallery',config='height=550 ,
width=750,toolbar=no, menubar=no, scrollbars=no, resizable=no,
location=no, directories=no, status=no');
-->
</SCRIPT>

Obviously, it opens a new browser window with my Photo Gallery in it.

How do I convert it into a "function" in the <head> section to call
later from a link or from within a Flash movie? And, what is the
wording that I would use to call it that would be placed in the <a
href="javascript:??> section?

Thanks for the help!

Mike
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Jul 20 '05 #1
5 2740

"Michael Stevens" <bigmikeatbigmikesdotorg> wrote in message
news:h8********************************@4ax.com...
Probably the wrong wording but since I'm not a scripter I won't claim
to know what I'm talking about.

I got this script from www.htmlgoodies.com

<script language="JavaScript">
<!-- ]
function winOpen()

{

window.open ('photos01.html','photogallery',config='height=550 ,
width=750,toolbar=no, menubar=no, scrollbars=no, resizable=no,
location=no, directories=no, status=no');

}
or better still

function winOpen(url)

{

window.open ( url ,'photogallery',config='height=550,
width=750,toolbar=no, menubar=no, scrollbars=no, resizable=no,
location=no, directories=no, status=no');

}

-->
</SCRIPT>

you can call like this

<a href=javascript : winOpen('photos01.html') > mylink </a>



Obviously, it opens a new browser window with my Photo Gallery in it.

How do I convert it into a "function" in the <head> section to call
later from a link or from within a Flash movie? And, what is the
wording that I would use to call it that would be placed in the <a
href="javascript:??> section?

Thanks for the help!

Mike
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption

=---
Jul 20 '05 #2
On Sat, 26 Jul 2003 18:23:37 +0800, "Mosley Jones III"
<me@info.gov.mars> woke me from my slumber by saying:
or better still

function winOpen(url)
{
window.open ( url ,'photogallery',config='height=550,
width=750,toolbar=no, menubar=no, scrollbars=no, resizable=no,
location=no, directories=no, status=no');
}
-->
</SCRIPT>

you can call like this

<a href=javascript : winOpen('photos01.html') > mylink </a>


So, again remember my ignorance, in javascript the window.open
function has basically three variables (url, name, config) and they
appear in that order so that in your "better" example since url is not
inside ' ' the function assumes that the variable, in this case the
url, will be supplied when called from a link? Just so I know what's
going on. It's easier to mess with when you know what's going on.

Thanks for the help!

Mike
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Jul 20 '05 #3
On 26 Jul 2003 04:38:40 +0200, Lasse Reichstein Nielsen
<lr*@hotpop.com> woke me from my slumber by saying:
Michael Stevens <bigmikeatbigmikesdotorg> writes:
Probably the wrong wording but since I'm not a scripter I won't claim
to know what I'm talking about.

I got this script from www.htmlgoodies.com

<script language="JavaScript">
<!--
window.open ('photos01.html','photogallery',config='height=550 ,
width=750,toolbar=no, menubar=no, scrollbars=no, resizable=no,
location=no, directories=no, status=no');
-->
</SCRIPT>


Not impressive code.


I don't know that it is supposed to be ...
Obviously, it opens a new browser window with my Photo Gallery in it.

How do I convert it into a "function" in the <head> section to call
later from a link or from within a Flash movie?


Don't know about Flash, but if you want to call it from a link, you might
want to call it from more than one link, so I have made the actual URL
an argument of the function.

This should be what you need:

<script type="text/javascript">
function myOpenWindow(url) {
window.open(url,"photogallery","heigth=550,width=7 50,toolbar=no,"+
"menubar=no,scrollbars=no,resizable=no,location=no ,"+
"directories=no,status=no");
}
</script>

Every change compared to the original is deliberate and for the better.
And, what is the wording that I would use to call it that would be
placed in the <a href="javascript:??> section?


Don't use "href='javascript:...'" (it's in the FAQ, which is sadly down
at the moment: <URL:http://jibbering.com/faq/>.
Instead:

<a href="photos01.html" target="photogallery"
onclick="myOpenWindow(this.href);return false;">
link text</a>(opens in new window)

Make it obvious that clicking this link will open a new window.
Make sure that people without javascript can also use the page.


Actually, that's a good idea. I don't know how that will be
implemented in Flash but I'll have to do some checking & playing
around to see how to make it work.

One question: if someone doesn't have javascript enabled how will they
be able to use the page? Your HREF doesn't have a "javascript:..." in
it but that doesn't change the fact that it is calling a JavaScript
function, does it?

Thanks,

Mike
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Jul 20 '05 #4
Michael Stevens <bigmikeatbigmikesdotorg> writes:
One question: if someone doesn't have javascript enabled how will they
be able to use the page? Your HREF doesn't have a "javascript:..." in
it but that doesn't change the fact that it is calling a JavaScript
function, does it?


If they don't have javascript (or it isn't enabled) then it will act
as a normal link with a target. The page whose URL is in the "href"
attribute, is openend in a new window with the name taken from the
"target" attribute. The javascript is never executed. The only thing
that the javascript does is to add the "config" part of the window.open
call, to change the initial size and properties of the new window.
Without javascript, you just get a plain new window, but it works.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #5
On 27 Jul 2003 13:12:46 +0200, Lasse Reichstein Nielsen
<lr*@hotpop.com> woke me from my slumber by saying:
Michael Stevens <bigmikeatbigmikesdotorg> writes:
One question: if someone doesn't have javascript enabled how will they
be able to use the page? Your HREF doesn't have a "javascript:..." in
it but that doesn't change the fact that it is calling a JavaScript
function, does it?


If they don't have javascript (or it isn't enabled) then it will act
as a normal link with a target. The page whose URL is in the "href"
attribute, is openend in a new window with the name taken from the
"target" attribute. The javascript is never executed. The only thing
that the javascript does is to add the "config" part of the window.open
call, to change the initial size and properties of the new window.
Without javascript, you just get a plain new window, but it works.

/L


Cool.

As I was pondering how to execute that in Flash it dawned on me that I
probably won't have to worry about it. There seem to be those people
that disable everything but plain old html. So, if they're viewing the
Flash file chances are pretty good that they have javascript enabled
as well as their Flash plugin.

Thanks again,

Mike
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Jul 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Bradley Plett | last post by:
I have what should be a trivial problem. I am using XMLSerializer to serialize an object. It serializes boolean values as "True" and "False". I then want to use an XSLT on this XML, and I want...
6
by: Clément Collin | last post by:
I working on a GIS project, with Access link which just need a little routine in VBA, but I haven't knowledges in VBA language. It's very simple, and it looks like that in a TPascal way : .......
7
by: Jim Bancroft | last post by:
Hi everyone, A basic one here, I think. I haven't found the pattern yet, but sometimes when I cast a variable to another type using the "C" style cast operator the compiler refuses to play...
5
by: Greg Collins [InfoPath MVP] | last post by:
I couldn't find anything in my searches... I'm wondering if there's a Regex (with or without additional C# code) that can convert a either "lowerCamelCase" or "UpperCamelCase" into a proper "Title...
3
by: duprejonathan | last post by:
Hello, i don't know how to format a string with an SQL select query for my VB6 App. I have a table like this : Code - Name 1 - Jonathan 2 - Mike .... 9 - Claudia 10 - Robbie
1
by: sensamecca | last post by:
I need to convert single bytes to their Hex equivalent in C#. This means a 2 character representation in a string that is the hex number. This is done with the Hex function in VB to which there...
6
by: arti | last post by:
I dont want to use Convert(Char(9),date,106) function to show date in dd/MM/yyyy format. It changes the datatype of my column to char & I cant perform other date operations on it without changing it...
28
by: Jess | last post by:
Hello, It is said that if I implement a "swap" member function, then it should never throw any exception. However, if I implement "swap" non- member function, then the restriction doesn't...
4
by: jiatiejun | last post by:
I want to convert a path from ~/xxx/xxx.gif to 'http://xxxxxxx/xxx/xxx.gif' how to convert it? thanks btw: the convert function allow
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.