473,386 Members | 1,798 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.

Using / passing a variable - n00b question :)

I am creating an initial index.htm page on which I show some disclaimers and
introduction information.

In the head section I have Javascript which determines the screen resolution of
the client. I assign values to two variables to assign the width and height.
(my_width and my_height).

I have a Form button which is clicked on agreeing to the disclaimers. On
clicking the form button I want to direct the user (open a new window) to a
specific URL (sub-directory) in which I have specific files for use with a
screen resolution.

The form button works OK with the following in the <body> :

</div>
<FORM>
<div align="center">
<input name="Agree" type="button" id="Continue" onFocus="this.blur()"
onClick="NewWindow('640x480/redirect.htm','New','640','480','no','center');ret urn
false" value="I Agree">
</div>
</FORM></td>

How do I use the variables my_width and my_height to automatically load the
appropriate redirect.htm in the correct direct name ('640x480' or '800x600'
etc)?

Thanks.

Mal
Remove x- for correct email addy
Jul 23 '05 #1
12 1423
On Sat, 28 Aug 2004 15:40:57 +0100, Mal Ice <sp**@tembographics-x.com> wrotf:

I forgot to add that I have a user created function called NewWindow...

var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math .floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Mat h.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(scr een.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") ||
pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPositi on+',left='+LeftPosition+',scrollbars='+scroll+',l ocation=no,directories=no,status=no,menubar=no,too lbar=no,resizable=no';
win=window.open(mypage,myname,settings);}

I suppose this has an impact on how my_width and my_height get used in the
"onClick" instructions to run the NewWindow function.

Mal

Remove x- for correct email addy
Jul 23 '05 #2
Mal Ice wrote:
I am creating an initial index.htm page on which I show some disclaimers and
introduction information.

In the head section I have Javascript which determines the screen resolution of
the client. I assign values to two variables to assign the width and height.
(my_width and my_height).

I have a Form button which is clicked on agreeing to the disclaimers. On
clicking the form button I want to direct the user (open a new window) to a
specific URL (sub-directory) in which I have specific files for use with a
screen resolution.


You can stop right there. Screen resolution has nothing to do with
browser size. My desktop is 2048 pixels wide, and 768 pixels high. But
my browser window is smaller than 800x600, so which page should I get?

http://allmyfaqs.com/faq.pl?AnySizeDesign
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #3
On Sat, 28 Aug 2004 11:54:45 -0400, Randy Webb <Hi************@aol.com> wrotf:
Mal Ice wrote:
I am creating an initial index.htm page on which I show some disclaimers and
introduction information.

In the head section I have Javascript which determines the screen resolution of
the client. I assign values to two variables to assign the width and height.
(my_width and my_height).

I have a Form button which is clicked on agreeing to the disclaimers. On
clicking the form button I want to direct the user (open a new window) to a
specific URL (sub-directory) in which I have specific files for use with a
screen resolution.


You can stop right there. Screen resolution has nothing to do with
browser size. My desktop is 2048 pixels wide, and 768 pixels high. But
my browser window is smaller than 800x600, so which page should I get?

http://allmyfaqs.com/faq.pl?AnySizeDesign


I am not concerned about the size of the browser window that opens my initial
page, I want to control the size of the browser on clicking a button. I'll
check the screen size (not browser size) and then determine what URL I will use
on a button click

if (screen.width==640||screen.height==480) //if 640x480
var screen2="640x480/redirect.htm",my_width ="640",my_height ="480"
else if (screen.width==800||screen.height==600) //if 800x600
var screen2="800x600/redirect.htm",my_width ="800",my_height ="600"

else if (screen.width==1024||screen.height==768) //if 1024x768
var screen2="1024x768/redirect.htm",my_width ="1024",my_height ="768"

else //if all else
var screen2="1024x768/redirect.htm",my_width ="1024",my_height ="768"
I will open the URL with a specified browser size (using variables) that relates
to the screen width and height that will maximise screen collateral to display
images.

Does this make sense?

TIA

Mal
Remove x- for correct email addy
Jul 23 '05 #4
On Sat, 28 Aug 2004 17:49:51 +0100, Mal Ice wrote:
I am not concerned about the size of the browser window that opens my initial
page, I want to control the size of the browser on clicking a button. I'll
check the screen size (not browser size) and then determine what URL I will use
on a button click


'I', four times in that sentence.

What will your *users* want?

[ Most users prefer a page that adjusts to
'any-damn size' they choose at that instant. ]

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
Jul 23 '05 #5
On Sun, 29 Aug 2004 04:28:19 GMT, Andrew Thompson wrote:
'I', four times in that sentence.


OK ..paragraph. [ ;-) ]

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
Jul 23 '05 #6
Mal Ice wrote:
On Sat, 28 Aug 2004 11:54:45 -0400, Randy Webb <Hi************@aol.com> wrotf:

Mal Ice wrote:
I am creating an initial index.htm page on which I show some disclaimers and
introduction information.

In the head section I have Javascript which determines the screen resolution of
the client. I assign values to two variables to assign the width and height.
(my_width and my_height).

I have a Form button which is clicked on agreeing to the disclaimers. On
clicking the form button I want to direct the user (open a new window) to a
specific URL (sub-directory) in which I have specific files for use with a
screen resolution.
You can stop right there. Screen resolution has nothing to do with
browser size. My desktop is 2048 pixels wide, and 768 pixels high. But
my browser window is smaller than 800x600, so which page should I get?

http://allmyfaqs.com/faq.pl?AnySizeDesign

I am not concerned about the size of the browser window that opens my initial
page, I want to control the size of the browser on clicking a button. I'll
check the screen size (not browser size) and then determine what URL I will use
on a button click


No, you will *attempt* to open a window that you (incorrectly) *think*
is the right size and resolution. Had you bothered to read the article I
referenced, you might understand that. So, let me say it simply. This
is MY browser. Leave it the @#$@ alone as far as resizing, removing
chrome or any other thing you *think* you can accomplish. Before you get
annoyed, let me explain it. I use norton. It has this neat little
section of script it inserts in all pages, that disables the window.open
call. I also have window resizing disabled. So, how do you intend to
*attempt* to open a window a certain size? And I am not the only person
on the web that uses popup blocking software.
if (screen.width==640||screen.height==480) //if 640x480
Thats a dubious test. If the screen width is 640, 100-1 the height is
480 and vice versa. No need to test for one or the other.
var screen2="640x480/redirect.htm",my_width ="640",my_height ="480"
else if (screen.width==800||screen.height==600) //if 800x600
var screen2="800x600/redirect.htm",my_width ="800",my_height ="600"
Same as above.
else if (screen.width==1024||screen.height==768) //if 1024x768
var screen2="1024x768/redirect.htm",my_width ="1024",my_height ="768"
Same as above.
else //if all else
var screen2="1024x768/redirect.htm",my_width ="1024",my_height ="768"
So, thats where I would fall in. Or rather, where you *think* I should
fall in. What makes you think you are the one to decide what size to
make *my* browser window? Its mine, leave it the !@#! alone.

I will open the URL with a specified browser size (using variables) that relates
to the screen width and height that will maximise screen collateral to display
images.
See above. Give me an image, let *me* decide what size I want my window,
because in the end, I *will* be the one to decide.
Does this make sense?
About as much sense as attempting to kiss a wildcat after sandpapering
its ass.
TIA


Welcome.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #7
In article <ei********************************@4ax.com>,
Mal Ice <sp**@tembographics-x.com> wrote:
I am creating an initial index.htm page on which I show some disclaimers and
introduction information.
Folks are assuming you are writing for the internet here. The answers
may be different if your were writing for a company intranet.

Are you planning on pestering me every time I enter your site with these
questions? Why should I enter your site?
I have a Form button which is clicked on agreeing to the disclaimers. On
clicking the form button I want to direct the user (open a new window) to a
specific URL (sub-directory) in which I have specific files for use with a
screen resolution.


Why don't you simplify you design by using the existing window? If I
want a new window, I could do a right click and select display the link
in a new window before I got to your site. I think it will be faster
for me to drag the window to a larger size the learning a unique user
interface for your site. Think how yahoo, ebay, and amazon act.

Any reason why you are not?

I think most internet user are a rather impatient lot. Why are you
slowing them down?

Maybe you are doing some copyright or bank verification task and you
need need to do this.

If
Jul 23 '05 #8
On Mon, 30 Aug 2004 02:38:53 GMT, Robert <rc*******@my-deja.com> wrotf:
In article <ei********************************@4ax.com>,
Mal Ice <sp**@tembographics-x.com> wrote:
I am creating an initial index.htm page on which I show some disclaimers and
introduction information.
Folks are assuming you are writing for the internet here. The answers
may be different if your were writing for a company intranet.

Neither. A bit of self promotion on a business card-sized cd. Browsers are the
most ubiquitous display mechanisms on both PC and Mac. I wanted something cross
platform.
Are you planning on pestering me every time I enter your site with these
questions? Why should I enter your site? It isn't a "site". As the material I am presenting is copyright (art images) I
want to get them to positively acknowledge that fact. They will do this just
once. Either I will be contacted about doing some work for them or my $0.80
"eCard" will be in the bin. This is likely to be a "single hit" project. So no
"pestering" on my behalf.
I have a Form button which is clicked on agreeing to the disclaimers. On
clicking the form button I want to direct the user (open a new window) to a
specific URL (sub-directory) in which I have specific files for use with a
screen resolution.

Why don't you simplify you design by using the existing window? If I
want a new window, I could do a right click and select display the link

Not with a javascript to prevent a right click you cant.in a new window before I got to your site. I think it will be faster
for me to drag the window to a larger size the learning a unique user
interface for your site. Think how yahoo, ebay, and amazon act. A single click of a single button which says "Continue" is hardly a learning
experience!
Any reason why you are not?
I do not know of any other way of getting the client browser not to display the
tool bar, links, scroll bars etc. WITHOT having to open another window. I want
to have a "clean" interface (top title and bottom status bar only) filling the
client screen size. A "Chromeless" pop-up window apparently is not supported
under XP SP1, and pop-ups are hit and miss if browsers are blocking them.
Opening a new window may be the both the best and easiest option to get my clean
interface with minimal user input other than putting an autorun cd in their PC
or MAC and clicking a single button.
I think most internet user are a rather impatient lot. Why are you
slowing them down? To the contrary me thinks.
Maybe you are doing some copyright or bank verification task and you
need need to do this. Yup.
If

Thanks for listening.

Mal
Remove x- for correct email addy
Jul 23 '05 #9
On Sat, 28 Aug 2004 15:40:57 +0100, Mal Ice <sp**@tembographics-x.com> wrotf:


</div>
<FORM>
<div align="center">
<input name="Agree" type="button" id="Continue" onFocus="this.blur()"
onClick="NewWindow('640x480/redirect.htm','New','640','480','no','center');ret urn
false" value="I Agree">
</div>
</FORM></td>

How do I use the variables my_width and my_height to automatically load the
appropriate redirect.htm in the correct direct name ('640x480' or '800x600'
etc)?

To answer my own question....

I need to use the variables in the following format:

'+my_width+'

I cannot just use the variable in this way:

'my_width'.

Simple when you know how. And I didn't until I had to look at the sources of a
few javascripts on the net (Dynamic Drive to be precise!).

Mal

Remove x- for correct email addy
Jul 23 '05 #10
Mal Ice <sp**@tembographics-x.com> wrote in message
Neither. A bit of self promotion on a business card-sized cd.
Browsers are the most ubiquitous display mechanisms on both PC and Mac.
I wanted something cross platform.
Seems like good application to me.

People were thinking that you were writing an Internet application.
The eCard is a different situation.

I would still recommend that you let the user resize the window and
have scroll bars. The user may want to have your eCard on the screen
and look at some other application on the computer. Like update their
address book. It would be a pain to have to copy down you phone
number on a piece of paper.
interface with minimal user input other than putting an autorun cd in their PC
or MAC and clicking a single button.


I do not know how, but I suspect you could get invoke IE on your page
through an autorun file. I looked in an autorun file once and you
could see were an exe file was invoked.

Good luck with you eCard.

Robert
Jul 23 '05 #11
Mal Ice wrote:
I am creating an initial index.htm page on which I show some disclaimers
and introduction information.

In the head section I have Javascript which determines the screen
resolution of the client.
It is impossible to do that. And even if you could, it would be not of much
use to you:

Display resolution != desktop size != browser window size != viewport size.
[psf 3.7]
I assign values to two variables to assign the width and
height. (my_width and my_height).
<http://www.geocities.com/peace_cake.geo/img/fullscreen.htm>
(Courtesy of Steffen Laubner)
I have a Form button which is clicked on agreeing to the disclaimers.
You don't really need disclaimers on Web sites.
On clicking the form button I want to direct the user (open a new window)
to a specific URL (sub-directory) in which I have specific files for use
with a screen resolution.

The form button works OK with the following in the <body> :

</div>
Where is the corresponding <div>?
<FORM>
This is invalid HTML. An "action" attribute value is required.

<http://validator.w3.org/>
<div align="center">
The "align" attribute is deprecated in favor of CSS and may be used with
Transitional DTDs only.

<div style="margin-left:auto; margin-right:auto;">...</div>
<input name="Agree" type="button" id="Continue" onFocus="this.blur()"
Your "onFocus" attribute value prevents keyboard navigation to this button
which is a Bad Thing, even on an intranet.
onClick="NewWindow('640x480/redirect.htm','New','640','480','no',
'center');return false"
Since this is not a visual hyperlink, it is not required to cancel the
"click" event. Remove ";return false".
value="I Agree">
Without support for client-side scripting, users will not be able to
use that button, too. Use a submit button (input[type="submit"]) and
perhaps a server-side application.
</div>
</FORM></td>
The "form" element should be parent of the table if the table contains
tabular information. If it does not, you should use CSS instead.
How do I use the variables my_width and my_height to automatically load
the appropriate redirect.htm in the correct direct name ('640x480' or
'800x600' etc)?
Do you mean _directory_ name? (JFYI: It is not really a directory but
a URI path component.)

NewWindow(my_width + 'x' + my_height + '/redirect.htm');

But as I already pointed out, optimization for a certain resolution is
utter nonsense, and so using the above line is.
Remove x- for correct email addy


No, I won't. Instead, you will either stop spoiling the global second-level
domain namespace and change your From header to something appropriate, i.e.
something that applies to Internet/ Usenet standards (RFC 2822 says: "A
mailbox receives mail"; RFC 1036 specifies the From header to contain an
address in the Internet format), to the Netiquette (RFC 1855) and last but
not least to the Acceptable Use Policy of your service provider[1], or
consider yourself killfiled globally as well as a formal complaint sent to
your SP (Nildram Ltd.) which may cause restriction or cancellation of your
access to the service. You have been warned.

<http://www.interhack.net/pubs/munging-harmful/>
PointedEars
___________
[1] <http://www.nildram.net/pdf/Naup0904.pdf>, page 2
Jul 23 '05 #12
JRS: In article <16****************@PointedEars.de>, dated Sat, 4 Sep
2004 13:31:52, seen in news:comp.lang.javascript, Thomas 'PointedEars'
Lahn <Po*********@web.de> posted :
Remove x- for correct email addy


No, I won't. Instead, you will either stop spoiling the global second-level
domain namespace and change your From header to something appropriate, i.e.
something that applies to Internet/ Usenet standards (RFC 2822 says: "A
mailbox receives mail"; RFC 1036 specifies the From header to contain an
address in the Internet format), to the Netiquette (RFC 1855) and last but
not least to the Acceptable Use Policy of your service provider[1], or
consider yourself killfiled globally as well as a formal complaint sent to
your SP (Nildram Ltd.) which may cause restriction or cancellation of your
access to the service. You have been warned.

Ignore him; he's trying to start the Fourth Reich single-handedly.

He's also a hypocrite, as he disdains to comply accurately with the
accepted standards in his own postings. Whether he understands why is
not important.

Heil Thomas!

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME. ©
Web <URL:http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
Proper <= 4-line sig. separator as above, a line exactly "-- " (SonOfRFC1036)
Do not Mail News to me. Before a reply, quote with ">" or "> " (SonOfRFC1036)
Jul 23 '05 #13

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

Similar topics

58
by: jr | last post by:
Sorry for this very dumb question, but I've clearly got a long way to go! Can someone please help me pass an array into a function. Here's a starting point. void TheMainFunc() { // Body of...
7
by: Doug | last post by:
Is there any harm in passing an object into a method with the 'ref' keyword if the object is already a reference variable? If not, is there any benefit?
3
by: James Robertson | last post by:
I am new to the ASP and VB thing so be kind. Question I have is that I have created an ASPX web site to use as an E-Mail page. But I want to use this for a lot of users. Can I create the link on...
0
by: James Robertson | last post by:
OK so I have that and get it. Now here is my code, I want to insert the www.mydomain.com?email=username@domain.com to the string "USER@DOMAIN.NET" to accept the variable from elier. How and where?...
6
by: semkaa | last post by:
Can you explain why using ref keyword for passing parameters works slower that passing parameters by values itself. I wrote 2 examples to test it: //using ref static void Main(string args) {...
8
by: Roland Hall | last post by:
In Access you use "*" + + "*", + can be replaced with & Calling a parameterized query in Access requires % be used in place of *, however, all that I have read show dynamic SQL passed to Access: ...
3
by: DaTurk | last post by:
If I call this method, and pass it a byte by ref, and initialize another byte array, set the original equal to it, and then null the reference, why is the original byte array not null as well? I...
2
by: pcaisse | last post by:
Could someone please tell me why this stupid script doesn't print the string being passed to the sub?: #!/usr/bin/perl -w use strict; print "Work, damnit!\n"; my $val = "print me";
65
by: Arjen | last post by:
Hi, Form a performance perspective, is it wise to use the ref statement as much as possible? Thanks! Arjen
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
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
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...

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.