Chopenko
Junior Member
Posts: 9
Registered: 10/30/2007
Location: México
Member Is Offline
|
| posted on 10/30/2007 at 11:09 PM |
|
|
Partial Solution
I found this works, though slow, I think it's because it has to resolve the DNS first.
The calendar takes more time to popup.
The code is taken from IE 404 Page.
-----------------------------------------------------------------------------
//For testing use
//DocURL= "res://shdocvw.dll/http_404.htm#https://www.microsoft.com/bar.htm"
DocURL=document.location.href;
//this is where the http or https will be, as found by searching for :// but skipping the res://
protocolIndex=DocURL.indexOf("://", 4);
//this finds the ending slash for the domain server
serverIndex=DocURL.indexOf("/", protocolIndex + 3);
//for the href, we need a valid URL to the domain. We search for the # symbol to find the begining
//of the true URL, and add 1 to skip it - this is the BeginURL value. We use serverIndex as the end marker.
//urlresult=DocURL.substring(protocolIndex - 4,serverIndex);
BeginURL=DocURL.indexOf("#",1) + 1;
urlresult=DocURL.substring(BeginURL, serverIndex);
if (protocolIndex - BeginURL > 7)
urlresult=""
//for display, we need to skip after http://, and go to the next slash
displayresult=DocURL.substring(protocolIndex + 3, serverIndex);
var obj_calwindow = window.open('http://'+displayresult+'/CMSG/Calendar/calendar.html?id='...
-----------------------------------------------------------------------------
As you can see, it's by using absolute path.
|
|
|
bmn
Junior Member
Posts: 2
Registered: 8/22/2007
Member Is Offline
|
| posted on 1/9/2008 at 08:57 PM |
|
|
Better solution
Actually, it is easier this way:
The popup is called from 'calendar.html' on line 98 - obj_caller.popup(dt_datetime.valueOf());
So u can rename it to for example obj_caller.popup2 and
in calendar?.js make popup2 function exactly the same as popup1,
just change the address to one which is ok for calendar.html.
finally, don't forget to assign it in the beginning of the js file: this.popup2 = cal_popup2;
that way there are 2 popup functions, one called first time from your page and the
other called from calendar.html
of course it's a lousy solution, it would be better to make a decision which address to use
by a parameter in the popup function, but who cares...
|
|
|
tigra
Administrator
Posts: 1976
Registered: 6/17/2002
Location: US, CO
Member Is Offline
|
| posted on 1/10/2008 at 12:32 AM |
|
|
and then there's good old absolute path that works from everywhere and doesn't involve tricky server setup.
/js/calendar.html
or
http://www.domain.com/js/calendar.html
|
|
|
Chopenko
Junior Member
Posts: 9
Registered: 10/30/2007
Location: México
Member Is Offline
|
| posted on 1/10/2008 at 02:10 AM |
|
|
| Quote: | Originally posted by tigra
and then there's good old absolute path that works from everywhere and doesn't involve tricky server setup.
/js/calendar.html
or
http://www.domain.com/js/calendar.html |
Hi Tigra, thanks for the calendar, it's just simple and fast, I like it so much.
I even modified a little bit the script to make a simple Day selector, so when I picked a Day, the script would return and write two fields, one with
01/01/08 00:00:00 and another with 01/01/08 23:59:59.
Yeah, I know it's better to use that method, but since I was working on my local apache Sever I didn't wanted to edit anything when I finished the
project. The project was for another person and that person was in charge of uploading and maintaining the online server.
|
|
|