473,804 Members | 3,497 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

javascript alert problem

<script language="JavaS cript">
!--
function onLoad()
{
if( self.innerWidth < 1024 )
{
self.moveTo( 0, 0 );
self.resizeTo( screen.availWid th, screen.availHei ght );
}

if( self.innerWidth < 1024 )
{
alert( "This Web page was designed to be viewed using a" + " screen
resolution of 1024x768 or larger." );
}
}

Why thus code is not working when my screen resolution is 800*600? Please
Help!!

--
Thanks and Regards

Jorn
Jul 23 '05 #1
6 2056
Jorntk wrote on 04 mei 2004 in comp.lang.javas cript:
<script language="JavaS cript">
!--
function onLoad()
{
if( self.innerWidth < 1024 )
{
self.moveTo( 0, 0 );
self.resizeTo( screen.availWid th, screen.availHei ght );
}

if( self.innerWidth < 1024 )
{
alert( "This Web page was designed to be viewed using a" + " screen
resolution of 1024x768 or larger." );
}
}


dit you try this [oonly this code in a html-file:

<body onload="alert(s elf.innerWidth) ">

??

undefined

=============== ===

Now try:

<body onload="alert(s creen.availWidt h)">

See:
<http://msdn.microsoft.com/workshop/
author/dhtml/reference/dhtml_reference _entry.asp>

and perhaps also:
<http://msdn.microsoft. com/workshop/author/om/measuring.asp>

because client users more often than not do not want full screen

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 23 '05 #2
Ok, it work now. But i got new problem.
I put the alert in a header.php where i will call the header.php everytime.
This cause the alert pop up when I click every button to view new page.
So, is there anyway to limit the alert to only pop up for one time??
Please advice. Thanx!
Jul 23 '05 #3
Ivo
"Jorntk" wrote
Ok, it work now. But i got new problem.
I put the alert in a header.php where i will call the header.php everytime. This cause the alert pop up when I click every button to view new page.
So, is there anyway to limit the alert to only pop up for one time??
Please advice. Thanx!


The usual way to do this is with a cookie or something serverside like a
session variable. There is no other way of knowing the difference between
first time visitors and those going to the next page.
But also to be considered: There might be a lot people going to the next
page if you leave it up to them to resize their window. And unless you have
something very special to show, you should not design for any specific
screen resolution at all. Most users do not even know how to change their
resolution (assuming, against better judgement, they would be willing to go
through of trouble of doing so only to see your site) so the javascript will
do nothing but annoy people.
HTH
Ivo
Jul 23 '05 #4
On Tue, 4 May 2004 19:13:33 -0700, Jorntk <jo****@yahoo.c om> wrote:
Ok, it work now. But i got new problem.
I put the alert in a header.php where i will call the header.php
everytime.
This cause the alert pop up when I click every button to view new page.
So, is there anyway to limit the alert to only pop up for one time??
Please advice. Thanx!


Frankly, you shouldn't do it at any time. The users don't know or care
what it was designed for. After all, their resolution will, more than
likely, be set to the optimal value anyway, so what good will it do? Sites
for the World Wide Web should use liquid design so it doesn't matter
(within reason) what the resolution is, large or small. Finally, screen
resolution means practially nothing. It's set to 1024x768 on this machine,
but you'll only get 866x582 to work with once you remove toolbars,
sidebars, and the like.

One final point, you do realise that statistics (unreliable as they are)
show the majority of users use 800x600, don't you?

Mike

--
Michael Winter
M.******@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 23 '05 #5
In article <40********@new s.tm.net.my>, jo****@yahoo.co m enlightened us
with...
<script language="JavaS cript">
!--
function onLoad()
{
if( self.innerWidth < 1024 )
{
self.moveTo( 0, 0 );
self.resizeTo( screen.availWid th, screen.availHei ght );
Um, you do know that us Opera and Mozilla users can disable that
nonsense, right?
You have no right to resize or move MY windows. Sorry.
}

if( self.innerWidth < 1024 )
{
alert( "This Web page was designed to be viewed using a" + " screen
resolution of 1024x768 or larger." );


I guess I won't be using your page. Neither will most people. The
majority of users use 800 by 600. And an alert? How annoying. I can
read. If you want to tell people that you can't code, just put it on the
page.

Gee, I sure hope disabled people don't need your site, either.

--
--
~kaeli~
A hangover is the wrath of grapes.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #6
Jorntk wrote:
Ok, it work now. But i got new problem.
I put the alert in a header.php where i will call the header.php everytime.
This cause the alert pop up when I click every button to view new page.
So, is there anyway to limit the alert to only pop up for one time??
Please advice. Thanx!


You only think you have it working. For starters, "self.innerWidt h" returns
"undefined" on Internet Explorer, which is always less then 1024 on Internet
Explorer.

On browsers like Gecko based browsers (Netscape 7.1, Mozilla, Firefox, Camino,
Opera 7.23), where self.innerWidth actually returns typeof "number", even a
user with a 1024 x 768 desktop will be told they aren't running their browser
at 1024 x 768, because window.innerWid th is ALWAYS less then the width of the
applicable desktop (due to borders and scrollbars and any side-docked
toolbars).

Not to mention that in Netscape 7.1, Mozilla and Firefox, browsers where you
are actually able to retrieve self.innerWidth (and make an incorrect assumption
about the size of their browser based on that value), users can disable the
ability for you to move or resize their browser.

--
| Grant Wagner <gw*****@agrico reunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
Jul 23 '05 #7

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

Similar topics

6
2159
by: francisco lopez | last post by:
ok , first of all sorry if my english is not so good, I do my best. here is my problem: I don´t know much javascript so I wrote a very simple one to validate a form I have on my webpage. could you please have a look at the following script: ------------------------------------------------------------
14
5491
by: tshad | last post by:
I posted this on the asp.net group, also. I wasn't sure whether this was an asp.net problem or a javascript problem. I have a page that was originally created from a program I found on the net that works well as an html page. It brings up a modal popup window that I have been trying to work out for days now and this was the closest I have been able to come. I added a little asp.net code and an asp.net button and cannot get it to
5
25856
by: elsenraat_76 | last post by:
Hello! I was wondering if someone could help me out with a problem I'm having? I'm trying to input a javascript value into an anchor tag (from a function), but don't have an event to call the function...if that makes sense. Here's what I mean... I have a javascript array set up like so: <script language="javascript" TYPE="text/JavaScript"> //custom object constructor
7
1686
by: e | last post by:
I've been having an extremely difficult time finding an answer to this in IE / js groups, so I thought I'd try here. I've got an aspx page that delivers loads of report data into custom-named <span> tags on the client, hidden from the screen by @media classes. From a dynamically built menu of what was returned, the user selects wich report they want to view/print and a little jscript .innerHTML magic happens under the hood that copies...
6
1577
by: Steve B. | last post by:
Hello everybody In a webpage, I use JS display data from an xml file and a xsl file: var data = new ActiveXObject("Microsoft.XMLDOM"); data.async = false; var dataUrl = "data.aspx"; data.load(dataUrl) ; var transform = new ActiveXObject("Microsoft.XMLDOM"); transform.async = false ;
9
4925
by: tshad | last post by:
This is from my previous post, but a different issue. I have the following Javascript routine that opens a popup page, but doesn't seem to work if called from an asp.net button. It seems to work fine from a link. The button does bring up the popup window, but when I press the links on the page, it doesn't return or close the window. ****************************************************************************
7
10983
by: C.Joseph Drayton | last post by:
I have a problem that I am hoping someone can help me with. First let me describe the problem. I have an HTML form that in one field has an onBlur call to a JavaScript function. When you exit the field, it calls the JavaScript routine, which in turn calls a PHP script. The PHP script runs returns the value needed. And returns to the JavaScript. The JavaScript function is then supposed to set alerts depending on the values returned from...
7
3965
by: petermichaux | last post by:
Hi, I have tried the following based on suggestions of the best way to insert JavaScript into a page. This is instead of using eval(). Unfortunately IE says "unexpected call to property or method access" for the second to last line of my function. If you know what I've done wrong or how to fix it I would appreciate the help.
16
1921
by: Tony Girgenti | last post by:
Hello. I just finished reading two articles about javascript here: http://msdn2.microsoft.com/en-us/library/bb332123(VS.80).aspx I tried some javascript testing in VS2005, SP1, VB , .NET 2.0, ASP.NET 2.0 on WIN XP Pro, SP2. It's real simple. I put a button on a page and coded the onClick in it like this:
9
2223
by: Matthew Wells | last post by:
OK, I've narrowed down the problem. This works when in the aspx page <script type="text/javascript" > function btnFirst_Click() { alert("Hello"); alert(document.getElementById("<%=LBFacilities.ClientID%>").options.length); return false; } </script>
0
9704
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9571
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
10561
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
10318
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
10069
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...
0
9132
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7608
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
5505
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...
2
3803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.