Using / passing a variable - n00b question :)

M

Mal Ice

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');return
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
 
M

Mal Ice

On Sat, 28 Aug 2004 15:40:57 +0100, Mal Ice <[email protected]> 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(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.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='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=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
 
R

Randy Webb

Mal said:
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
 
M

Mal Ice

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
 
R

Randy Webb

Mal said:
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.

Welcome.
 
M

Mal Ice

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.
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
 
M

Mal Ice

</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');return
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
 
R

Robert

Mal Ice said:
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
 
T

Thomas 'PointedEars' Lahn

Mal said:
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).

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 said:

This is invalid HTML. An "action" attribute value is required.

<div align="center">

The "align" attribute is deprecated in favor of CSS and may be used with
Transitional DTDs only.

<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
 
D

Dr John Stockton

JRS: In article <[email protected]>, dated Sat, 4 Sep
2004 13:31:52, seen in Thomas 'PointedEars'
Lahn said:
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!
 

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

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top