使用/传递变量 - n00b问题:) [英] Using / passing a variable - n00b question :)
问题描述
我正在创建一个初始index.htm页面,我在其上显示一些免责声明和
介绍信息。
在头部我有Javascript哪个确定客户端的屏幕分辨率
。我将值分配给两个变量以指定宽度和高度。
(my_width和my_height)。
我有一个表单按钮,单击同意免责声明。在
点击表单按钮我想将用户(打开一个新窗口)指向一个特定的URL(子目录),在该URL中我有特定的文件可供使用屏幕分辨率为
。
表单按钮在< body>中使用以下内容正常工作:
< / div>
< FORM>
< div align =" center">
< input name ="同意"类型= QUOT按钮" ID = QUOT;继续] onFocus =" this.blur()"
onClick =" NewWindow('''640x480 / redirect.htm'',''New'',''640'',''480 '',''不'',''中心''); ret urn
false" value =" I Agree">
< / div>
< / FORM>< / td>
如何使用变量my_width和my_height以正确的直接名称自动加载
相应的redirect.htm(''640x480''或''800x600''
等)?
谢谢。
Mal
删除x-以获取正确的电子邮件addy
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
推荐答案
2004年8月28日星期六15:40:57 +0100,Mal Ice< sp ** @ tembographics-x.com> wrotf:
我忘了添加我有一个名为NewWindow的用户创建函数...
var win = null;
函数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;}
if 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);}
我支持这对my_width和my_height在
" onClick"中的使用方式产生了影响。运行NewWindow功能的说明。
Mal
删除x-以获取正确的电子邮件地址
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
Mal Ice写道:
Mal Ice wrote:
我正在创建一个初始的index.htm页面,我在其中显示了一些免责声明和介绍信息。
在头部部分我有Javascript,它决定了客户端的屏幕分辨率。我将值分配给两个变量来分配宽度和高度。
(my_width和my_height)。
我有一个表单按钮,点击同意免责声明。单击表单按钮我想将用户(打开一个新窗口)指向特定URL(子目录),在该URL中我有特定文件用于
屏幕分辨率。
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.
你可以在那里停下来。屏幕分辨率与
浏览器大小无关。我的桌面宽2048像素,高768像素。但是
我的浏览器窗口小于800x600,那么我应该找哪个页面?
http://allmyfaqs.com/faq.pl?AnySizeDesign
-
Randy
comp.lang.javascript常见问题 - http://jibbering.com/faq
2004年8月28日星期六11:54:45 -0400,Randy Webb< Hi ************ @ aol .COM> wrotf:
On Sat, 28 Aug 2004 11:54:45 -0400, Randy Webb <Hi************@aol.com> wrotf:
Mal Ice写道:
Mal Ice wrote:
我正在创建一个初始的index.htm页面,我在其上显示了一些免责声明和
介绍信息。
在头部我有Javascript,它决定了客户端的屏幕分辨率。我将值分配给两个变量来分配宽度和高度。
(my_width和my_height)。
我有一个表单按钮,点击同意免责声明。单击表单按钮我想将用户(打开一个新窗口)指向特定URL(子目录),在该URL中我有特定文件用于
屏幕分辨率。
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.
你可以在那里停下来。屏幕分辨率与浏览器大小无关。我的桌面宽2048像素,高768像素。但是我的浏览器窗口小于800x600,那么我应该找哪个页面?
http://allmyfaqs.com/faq.pl?AnySizeDesign
我不担心的大小浏览器窗口打开我的初始
页面,我想在点击按钮时控制浏览器的大小。我会
检查屏幕尺寸(不是浏览器尺寸),然后确定我将使用的网址
点击按钮
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) //如果1024x768
var screen2 =" 1024x768 / redirect.htm",my_width =" 1024",my_height =" 768"
else //如果其他所有
var screen2 =" 1024x768 / redirect.htm",my_width =" 1024",my_height =" 768"
我将打开具有指定浏览器大小(使用变量)的URL,它将
与屏幕宽度和高度相关联,以最大化屏幕整理显示
图片。
这有意义吗?
TIA
>
Mal
删除x-以获取正确的电子邮件地址
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
这篇关于使用/传递变量 - n00b问题:)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!