473,666 Members | 2,294 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

old fuzzy brain trying to understand

What I am trying to should be everyday simple, but I just can't seem to
grasp it.

What I want to do is click a link and have that link send a URL to a
function to open a new widow of a certain size. I want to be able to use
the same function for several links. What I have so far is this in the
head

<script type="text/javascript" language="javas cript">
function smallWindow(myP age) {
window.open("my Page",toolbar=0 ,status=0,direc tories=0,menuba r=0,resizabl
e=0,dependant=1 ,width=400, height=300);
}

Then in the link I have in the body is

<a href="javascrip t:smallWindow(' http://www.somepage.co m')">somepage</a>

It will open a new window, but it can't find the specified page. It also
doesn't seem to be sizing to what I want. (BTW, the code is all on one
line, it's just wrapping in my news reader).

I know this should be an everyday simple thing, but I just can't seem to
get a hold on it.

thanks for any help in advance,

--
Dave
=============== ======
Majority sometimes only means that all the fools are on the same side.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.588 / Virus Database: 372 - Release Date: 2/13/2004
Jul 20 '05 #1
10 1329
Ivo
"Nom DePlume" <jd*@ccsispXXX. com> wrote in message
news:Qv******** ************@pr vlb.net...
What I am trying to should be everyday simple, but I just can't seem to
grasp it.

What I want to do is click a link and have that link send a URL to a
function to open a new widow of a certain size. I want to be able to use
the same function for several links. What I have so far is this in the
head

<script type="text/javascript" language="javas cript">
function smallWindow(myP age) {
window.open("my Page",toolbar=0 ,status=0,direc tories=0,menuba r=0,resizabl
e=0,dependant=1 ,width=400, height=300);
}
the window.open() takes three parameters:
1. the destination url
2. name of new window (if it exists already, it will be reused, if you don't
want this, give a unique name each time or just an empty string)
3. features.
In your code see only two parameters. myPage should not be in quotes as it
is supposed a variable and not to be confused with a literal text. The
features parameter should be in quotes but is not.
<a href="javascrip t:smallWindow(' http://www.somepage.co m')">somepage</a>


Use <a href="somepage" onclick="smallW in" etc.> instead.
so that people without javascript will also get the new page (albeit in the
original window)
Also, some browsers don't understand href="javascrip t:" very well. See the
newsgroup FAQ: <URL: http://jibbering.com/faq/#FAQ4_24 >
HTH
Ivo

Jul 20 '05 #2
Nom DePlume wrote:
What I am trying to should be everyday simple, but I just can't seem to
grasp it.

What I want to do is click a link and have that link send a URL to a
function to open a new widow of a certain size. I want to be able to use
the same function for several links. What I have so far is this in the
head

<script type="text/javascript" language="javas cript">
function smallWindow(myP age) {
window.open("my Page",toolbar=0 ,status=0,direc tories=0,menuba r=0,resizabl
e=0,dependant=1 ,width=400, height=300);
}


Man, you're so close: Try it without the quotes around the variable:

window.open(myP age, etc.

Jul 20 '05 #3

"mscir" <ms***@access4l ess.net> wrote in message
news:10******** *****@corp.supe rnews.com...
: Nom DePlume wrote:
: > What I am trying to should be everyday simple, but I just can't seem
to
: > grasp it.
: >
: > What I want to do is click a link and have that link send a URL to a
: > function to open a new widow of a certain size. I want to be able to
use
: > the same function for several links. What I have so far is this in
the
: > head
: >
: > <script type="text/javascript" language="javas cript">
: > function smallWindow(myP age) {
: >
window.open("my Page",toolbar=0 ,status=0,direc tories=0,menuba r=0,resizabl
: > e=0,dependant=1 ,width=400, height=300);
: > }
:
: Man, you're so close: Try it without the quotes around the variable:
:
: window.open(myP age, etc.

Tried that, but it didnt seem to make a difference.

Dave
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.588 / Virus Database: 372 - Release Date: 2/13/2004
Jul 20 '05 #4

"Ivo" <no@thank.you > wrote in message
news:40******** *************** @news.wanadoo.n l...
: "Nom DePlume" <jd*@ccsispXXX. com> wrote in message
: news:Qv******** ************@pr vlb.net...
: > What I am trying to should be everyday simple, but I just can't seem
to
: > grasp it.
: >
: > What I want to do is click a link and have that link send a URL to a
: > function to open a new widow of a certain size. I want to be able to
use
: > the same function for several links. What I have so far is this in
the
: > head
: >
: > <script type="text/javascript" language="javas cript">
: > function smallWindow(myP age) {
: >
window.open("my Page",toolbar=0 ,status=0,direc tories=0,menuba r=0,resizabl
: > e=0,dependant=1 ,width=400, height=300);
: > }
:
: the window.open() takes three parameters:
: 1. the destination url
: 2. name of new window (if it exists already, it will be reused, if you
don't
: want this, give a unique name each time or just an empty string)

Empty string.. I hadn't thought of doing that.

: 3. features.
: In your code see only two parameters. myPage should not be in quotes
as it
: is supposed a variable and not to be confused with a literal text. The
: features parameter should be in quotes but is not.
:
: > <a
href="javascrip t:smallWindow(' http://www.somepage.co m')">somepage</a>
:
: Use <a href="somepage" onclick="smallW in" etc.> instead.
: so that people without javascript will also get the new page (albeit
in the
: original window)

I think this is the part that is getting me confused. shouldn't the
onclick call to the function also include the URL? Otherwise it won't
know what page I want. that way I can use it for different links and
different pages. No?

: Also, some browsers don't understand href="javascrip t:" very well. See
the
: newsgroup FAQ: <URL: http://jibbering.com/faq/#FAQ4_24 >

Thanks for this. I'm burning it into my eyeballs now. :)

Dave
: HTH
: Ivo
:
:
:
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.588 / Virus Database: 372 - Release Date: 2/13/2004
Jul 20 '05 #5
Ivo
"Nom DePlume" <jd*@ccsispXXX. com> wrote in message
news:Qp******** ************@pr vlb.net...

"Ivo" <no@thank.you > wrote in message
news:40******** *************** @news.wanadoo.n l...
: "Nom DePlume" <jd*@ccsispXXX. com> wrote in message
: news:Qv******** ************@pr vlb.net...
: > <a
href="javascrip t:smallWindow(' http://www.somepage.co m')">somepage</a>
:
: Use <a href="somepage" onclick="smallW in" etc.> instead.
: so that people without javascript will also get the new page (albeit
in the
: original window)

I think this is the part that is getting me confused. shouldn't the
onclick call to the function also include the URL? Otherwise it won't
know what page I want. that way I can use it for different links and
Sorry, I was short there. We must pass the url with the function call, and
generate a return value of false in order to prevent the href from being
followed (that 's for the javascript-impaired remember). This can be done by
writing "return false" after the function call, but with the explicit return
in the function itself (last line) we can do it like this:
<a href=""
onclick="return smallWindow( 'http://www.somepage.co m' );"Here</a>


and the script:
<script type="text/javascript">
function smallWindow(myP age) {
window.open(
myPage ,
"myWindowNa me",
"resizable,depe ndant,width=400 , height=300" );
return false;
}

It may be on one line if you prefer :)
If you specify don't a features parameter, all toolbars etc. are turned on,
but if you specify only one item, everything is turned off by default.
Knowing this, it is sufficient just to mention the things you want enabled.
The "dependant" thing is Netscape-only I believe. You had "resizable" set to
0 but as you see I have included it because I see no reason why you would
that to your user. It takes up no space and only those that try to resize
will notice it, and be p*d to notice they can't. If you think otherwise, by
all means remove the word from the list.
HTH
Ivo

Jul 20 '05 #6
Ivo
"Nom DePlume" <jd*@ccsispXXX. com> wrote in message
news:Qp******** ************@pr vlb.net...

"Ivo" <no@thank.you > wrote in message
news:40******** *************** @news.wanadoo.n l...
: "Nom DePlume" <jd*@ccsispXXX. com> wrote in message
: news:Qv******** ************@pr vlb.net...
: > <a
href="javascrip t:smallWindow(' http://www.somepage.co m')">somepage</a>
:
: Use <a href="somepage" onclick="smallW in" etc.> instead.
: so that people without javascript will also get the new page (albeit
in the
: original window)

I think this is the part that is getting me confused. shouldn't the
onclick call to the function also include the URL? Otherwise it won't
know what page I want. that way I can use it for different links and
Sorry, I was short there. We must pass the url with the function call, and
generate a return value of false in order to prevent the href from being
followed (that 's for the javascript-impaired remember). This can be done by
writing "return false" after the function call, but with the explicit return
in the function itself (last line) we can do it like this:
<a href=""
onclick="return smallWindow( 'http://www.somepage.co m' );"Here</a>


and the script:
<script type="text/javascript">
function smallWindow(myP age) {
window.open(
myPage ,
"myWindowNa me",
"resizable,depe ndant,width=400 , height=300" );
return false;
}

It may be on one line if you prefer :)
If you specify don't a features parameter, all toolbars etc. are turned on,
but if you specify only one item, everything is turned off by default.
Knowing this, it is sufficient just to mention the things you want enabled.
The "dependant" thing is Netscape-only I believe. You had "resizable" set to
0 but as you see I have included it because I see no reason why you would
that to your user. It takes up no space and only those that try to resize
will notice it, and be p*d to notice they can't. If you think otherwise, by
all means remove the word from the list.
HTH
Ivo

Jul 20 '05 #7
On Fri, 27 Feb 2004 03:01:43 -0500, Nom DePlume <jd*@ccsispXXX. com> wrote:

[snip]
<script type="text/javascript" language="javas cript">
The language attribute is deprecated - remove it. The type attribute is
sufficient.
function smallWindow(myP age) {
window.open("my Page",toolbar=0 ,status=0,direc tories=0,menuba r=0,resizabl
e=0,dependant=1 ,width=400, height=300);
}
As you have already been shown in this thread, the function call should
look more like:

window.open(myP age,'target','d ependent,width= 400,height=300' );

where 'target' contains the name of the new window (more on this later).

Also notice the difference in the features string:

1) You spelt dependent incorrectly
2) Disabled features have been omitted
3) There are no spaces between the feature names (spaces aren't allowed in
the string)

Regarding the second point: if boolean features are omitted, they default
to off. This means you don't have to disable every option you don't intend
to use. You can further abbreviate the string by only including the name
of the feature; dependent and dependent=1 are equivalent.
Then in the link I have in the body is

<a href="javascrip t:smallWindow(' http://www.somepage.co m')">somepage</a>
[snip]

Ivo already pointed you to the FAQ section that comments on the JavaScript
pseudo-protocol. You should have read that the preferred format for the
element would be:

<a href="http://www.somepage.co m/"
onclick="smallW indow('http://www.somepage.co m/');return false"somepage</a>
You'll notice repetition there. You can shorten this to:

<a href="http://www.somepage.co m/"
onclick="smallW indow(this.href );return false"somepage</a>
where this.href will evaluate to the string, "http://www.somepage.co m/".

Finally, I noticed that you didn't like the idea of having to explicitly
specify a target name in the smallWindow() function as it adversely
affected the reusability. This doesn't have to be so: just pass in the
target name, as the following demonstrates:

function smallWindow( url, target ) {
return window.open( url, target, 'dependent,widt h=400,height=30 0');
}
...
<a href="http://www.somepage.co m/"
onclick="smallW indow(this.href ,'somepage');re turn false"somepage</a>


Mike

--
Michael Winter
M.******@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 20 '05 #8
Ivo wrote:
<snip>
... we can do it like this: <a href=""
onclick="return smallWindow( 'http://www.somepage.co m' );"
Here</a>

<snip>

Now you have lost the fall-back of having a real URL in the HREF. Better
might be:-

<a href="http://example.com" onclick="return smallWindow(thi s.href);">
Something a bit more meaningful than &quot;Here&quot ;</a>

But you haven't addressed the handling of the influence of pop-up
blocking software.

Richard.
Jul 20 '05 #9

"Nom DePlume" <jd*@ccsispXXX. com> wrote in message
news:Qv******** ************@pr vlb.net...
: What I am trying to should be everyday simple, but I just can't seem
to
: grasp it.
:
[snip]

Thank you everyone!

I think I am starting to get the grasp of this idea. Maybe if I was
20-something and grew up with computers on a daily basis it would be
different, but being 50+ and not having that advantage when younger this
is all rather new to me.

thanks again to everyone, and may your scripts always be bug free!

Dave
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.588 / Virus Database: 372 - Release Date: 2/13/2004
Jul 20 '05 #10

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

Similar topics

1
4193
by: Ray Gardener | last post by:
I was wondering if anyone had tried implementing fuzzy logic set concepts in C++, because in FL, the concept of "type" or "class" is fuzzy; things belong (or are of) a given type only by degree. e.g., in a hypothetical fuzzy C++ language one could say: class pickle : public vegetable 0.2 { // pickle is not so much a vegetable as, say, onion is. };
1
3776
by: Evaluating Fuzzy SW | last post by:
Hi All We are using soundex (and later tried Nysiis) for fuzzy name search software. But we faced a lot of problems the search accuracy was not very good also we saw a lot of misses of relevant names. There are many problems other than precision and accuracy, with soundex and NYSIIS.
2
1501
by: Stephanie Stowe | last post by:
Hi. I am trying to understand the weird System.DirectoryServices object model. I have a DirectoryEntry object. I want to enumerate through the PropertyCollection. So I looked at GetEnumerator. Lovely. My memory cannot dredge up how to use an enumerator. I do not understand the documentation, whcih does not contain little code snippets of examples like MSDN Oct 2001 for older technologies did. Can someone give me an enumerator basics 101...
7
1279
by: One Handed Man \( OHM - Terry Burns \) | last post by:
I've been battling with this stupid problem for hours now. WebApp: Trying to do a simple transformation using XSLT to a Web Page, but it just failes without an error message ( In other words, it bums out with a general exeption with no message ). It creates the Ouput.html, but errors and does not fill it with HTML.
28
1879
by: Siv | last post by:
Hi, If I run the following: strSQL = "Select * FROM Clients;" da = New OleDb.OleDbDataAdapter(strSQL, Conn) 'Create data adapter cb = New OleDb.OleDbCommandBuilder(da) 'Create command builder using the datadapter dt = New Data.DataTable da.Fill(dt) 'pour in the data using the adapter
24
14406
by: cassetti | last post by:
Here's the issue: I have roughly 20 MS excel spreadsheets, each row contains a record. These records were hand entered by people in call centers. The problem is, there can and are duplicate phone numbers, and emails and addresses even person names. I need to sift through all this data (roughly 300,000+ records and use fuzzy logic to break it down, so that i have only unique records.
11
8693
by: John Henry | last post by:
I am just wondering what's with get_close_matches() in difflib. What's the magic? How fuzzy do I need to get in order to get a match?
14
13477
by: Steve Bergman | last post by:
I'm looking for a module to do fuzzy comparison of strings. I have 2 item master files which are supposed to be identical, but they have thousands of records where the item numbers don't match in various ways. One might include a '-' or have leading zeros, or have a single character missing, or a zero that is typed as a letter 'O'. That kind of thing. These tables currently reside in a mysql database. I was wondering if there is a...
0
8356
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8866
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8781
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8639
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6192
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4366
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1772
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.