please help me solve a problem with my script... Some people say it works, while others say it doesn't... I am simply at a loss (admittedly, because I am really new to JavaScript).
Anyway, the script is on a parent page, it resizes it on load, and then opens and also resizes a new window with a calendar when people click on the word "calendar" on that parent page. It works just fine for me and many others as well, but some people tell me that they get Java errors when they click on the word "calendar".
What I so far tried to do to find the cause of the error was this:
1) replaced the line 'ENG/calendar_EN.html' with its full http:// path - no effect (works fine for me just as before but not for those who coudn't open that calender earlier either). The page "calendar_EN.html" is indeed in the same directory ("ENG") with its parent page.
2) repalced the "url" in brackets with the full http:// address - stopped working even for me
3) tried to replace single quotes around 'ENG/calendar_EN.html' with " - no go either...
Does anyone see a problem in my script? If so, what ist it? Why does it work for some people and doesn't for others??? I would greatly appreciate any help and advice!
Also, and while at it... I somehow sense that the problem is either with the function open_new_window or javascript:open_new_window('xxxxxxx'), or both...
What I basically want to do (and would also very much prefer to do it this way) is this:
I would like to have a simple <a href ........ </a> link to the word "calendar" on the parent page while placing all the self.move and self.resize stuff onto the page called for through this link (i.e., the page containing the calendar), and thus get rid of this (so far half working, half not) open_new_window thing on the parent page.
But then, if I place the self.move and self.resize things on the child page, how do I tell it not to show the toolbar, menubar, directories, etc., etc. from within this page and not from the parent page???
If this is all possible, how do I do it?
Millions of thanks in advance for any help!
Valery
Valery
12-21-2002, 06:57 AM
PS: I have no idea how those silly smilies managed to get into my message... I suspect they were inserted automatically in place of a "colon" followed by an "o"... Sorry for that anyway.
Charles
12-21-2002, 07:20 AM
On my browser neither the resizing of my window nor the 'calendar' link will work. The former is just fine with me - I cannot stand web authors messing with my windows - but the link to nowhere is a problem. Try instead:
And note, the people who are getting an error might be people with screens that are less than 700px wide.
Valery
12-21-2002, 08:32 AM
Charles,
thank you very much indeed for your prompt reply and for your great help! It works alright now!!! Wow! Many many thanks again!
Like they say, no good deed remains unpunished... so please allow me to torture you with another couple of questions:
1) In the variable you suggested to me I have changed the positioning of the calendar to left=0, top=0, so that it doesn't cover any part of its parent page. How do I place it into the upper _right_ corner of the screen (without knowing the screen size of the user)?
2) These two things screenX=100 and screenY=120 in the variable you suggested to me seem to have no effect - why? Still leave them there?
3) I have commented out these things in my previous script
and everything still works perfectly. Can I safely delete them completely?
4) Offline (while in DreamWeaver) the path to the calendar 'ENG/calendar_EN.html' works OK, but when I uploaded the page, the calendar could not be found... So I had to modify the path to look like this - '../ENG/calendar_EN.html'
Which would be the most reliable way for the calendar to be found - '../ENG/calendar_EN.html' or 'http://my_site.com/ENG/calendar_EN.html' ?
5) You are absolutely right in that you say I have to also think about people with screens less than 700 px (my screen is 15" and it looks just fine on it). The parent page (from which the calendar is called) is about 600 px wide and 700 px high. I certainly don't want to mess with peoples' windows but would simply like to position this parent window neatly in the middle of their screens for a better presentation - say, top=10, left= what??? What would you suggest?
Lots and lots of thanks yet again!
Valery
Charles
12-21-2002, 08:55 AM
1) You can know the size of a user's screen if the user has a screen and if the user is using JavaScript, but it gets a little ugly. Thus:
2) Microsoft recognizes 'top' and 'left', Netscape 'screenY' and 'screenX'.
3) Be done with it.
4) That's odd. But do what works and know the relative and absolute paths work equally well.
5) I would suggest that you get rid of all this JavaScript nonsense and let people's screens alone. If they want something in a new window then they know how to get it there. And no good ever comes of resizing or moving people's windows.
swon
12-21-2002, 09:16 AM
Another solution is following script. It works fine in most of the browsers:
<script language="JavaScript">
<!--
function winopens(url)
{
var winwidth = "400"; // your windowopen width;
var y = screen.availWidth; // width of screen
var right = y-winwidth;
var w = window.open(url,'yourwindowname','width='+winwidth+',height=250'); // opens the window;
w.moveTo(right,0); // 1st is left, 2nd is top
True, but it can cause flashing. Some users will see the window in its original position for just an instant before it is moved. And there is an error in my script above. As swon has noted, it should be screen.availWidth
Valery
12-21-2002, 09:56 AM
Charles and Swon,
thank you so much for your replies anf for your very interesting suggestions!!!
I will certainly check it all out ... have to digest it first :-)
---------------------------
Swon, please tell me, do I have to replace (url) with my page's real URL in your script?
<script language="JavaScript">
<!--
function winopens(url) <--- e.g. here ???
{
etc., etc.
Lots of thanks to both of you again!
Valery
swon
12-21-2002, 10:06 AM
No, that's an variable, generated by the a href of your link:
is a unit. Don't split it up and put it where you would the link.
ca_redwards
12-26-2002, 03:50 PM
I have created a free fully-navigable cross-browser pop-up calendar in less than 4K! See http://www.angelfire.com/ca/redwards/html__.calendar.html (http://www.angelfire.com/ca/redwards/html__.calendar.html) for details.
swon
12-26-2002, 04:29 PM
:Here's a calendar script that works for any browser that supports JavaScript 1.2
I have created a free fully-navigable cross-browser pop-up calendar in less than 4K! See http://www.angelfire.com/ca/redwards/html__.calendar.html for details.
Not bad, but my browser (IE6) gives me an Error on line one --- 1181 by clicking the calendar.
Valery
12-26-2002, 04:41 PM
Originally posted by ca_redwards
I have created a free fully-navigable cross-browser pop-up calendar in less than 4K! See http://www.angelfire.com/ca/redwards/html__.calendar.html (http://www.angelfire.com/ca/redwards/html__.calendar.html) for details.
In the calendar example above, here is the code that builds the empty calendar:
Above, an array of month names is built into select list m, which is concatenated with textbox y and hidden field date, before inclusion in a single table cell. Then, each of r's seven empty elements are defined as square buttons named d, and included in another table cell. Finally, h and seven copies of r (in an unnamed array) are defined as distinct table rows, included into a single table, for inclusion into form frm.
Hi, ca_redwards,
I have read the above as well as the rest of the text on the page you've indicated above... Then I tried to read Confucius (in original) and found the latter much more comprehensible - at least for me. Otherwise it's probably a nice calendar...
Thanks anyway!
Valery
ca_redwards
12-26-2002, 04:50 PM
What is the error? Can you quote its exact text...
That'd help me track it down.
ca_redwards
12-26-2002, 04:52 PM
Valery,
What is "Confucius" in you message refer to?
If you had any error after clicking the first two links on my calendar page, please let me know. Thanks!
Charles
12-26-2002, 04:55 PM
Originally posted by ca_redwards
Valery,
What is "Confucius" in you message refer to?
If you had any error after clicking the first two links on my calendar page, please let me know. Thanks! See http://zhongwen.com/rujia.htm.
ca_redwards
12-26-2002, 05:05 PM
Valery,
My explanation is confusing? Is that what you're saying?
Well, I guess I agree. The script that builds the pop-up calendar is kind of complex...
But here's another attempt to explain it more simply:
The popup calendar has two parts to it. The first loads several JavaScript functions (154!) needed by the second part. The second part utilizes these functions to build and popup the calendar.
Initially, the calendar is built empty. Then some JavaScript updates the display with the current date, and enables the calendar navigation.
Change the month and year to see a new monthly calendar. Select a particular date to popup an alert depicting that date.
Valery
12-27-2002, 05:11 AM
Hello Richard,
Originally posted by ca_redwards
My explanation is confusing? Is that what you're saying?
... The script that builds the pop-up calendar is kind of complex...
You bet... :-)
Now that you have explained how to use your calendar it became a bit clearer and I will check it out by all means.
To be frank, I wasn't actually looking for a new calendar - I already have one. What I asked here at the beginning of this thread was how to properly position that calendar on the user's screen and what JavaScript would open it without glitches I used to have before. Thanks to Charles and Swon the problem has been solved and I am more than happy with the results (Charles and Swon - are you listening? Many thanks again!).
But I will check yours anyway!
Thanks again,
Valery
-----------------------------------
PS: Charles, thanks you for stepping in re "what is Confucius"!
webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved.