JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old May 22nd, 2006, 09:33 PM
nckoi nckoi is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2006
Posts: 5 nckoi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 40 m 45 sec
Reputation Power: 0
Display variable

I need to display a variable. The variable is a .htm page that is calculated by a series of statements. Using documnet.write only displays the name of the file. I need to display the actual content of the file. Any help would be greatly appreciated. Thanks.

Reply With Quote
  #2  
Old May 22nd, 2006, 09:46 PM
ravs ravs is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2006
Location: gurgaon, haryana, india
Posts: 60 ravs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 44 m 29 sec
Reputation Power: 13
Send a message via Yahoo to ravs
hey
it is very hard to understand in this way.
because the details are less.
tell us actually what u r doing

Reply With Quote
  #3  
Old May 22nd, 2006, 10:09 PM
Kravvitz Kravvitz is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2005
Location: USA
Posts: 140 Kravvitz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 1 h 33 m 14 sec
Reputation Power: 14
You could use a server-side language, like PHP or ASP, to do that.

Or you could use an <iframe> if you can't use a server-side language.

Reply With Quote
  #4  
Old May 23rd, 2006, 07:11 PM
nckoi nckoi is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2006
Posts: 5 nckoi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 40 m 45 sec
Reputation Power: 0
I have a folder of 52 .htm files that I need to display one every week. I already have the code to get the correct file for the correct week. However, using document.write only displays the file name, not the content. I can either do this in a frame, or some other fashion as the case may warrant.

Reply With Quote
  #5  
Old May 23rd, 2006, 09:47 PM
ravs ravs is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2006
Location: gurgaon, haryana, india
Posts: 60 ravs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 44 m 29 sec
Reputation Power: 13
Send a message via Yahoo to ravs
hey if you know the correct file name and it is html file them why u are using document.write
if you know the file then u know the filepath also ,use iframe or frame and set its src to this file name.

Reply With Quote
  #6  
Old May 24th, 2006, 06:45 PM
nckoi nckoi is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2006
Posts: 5 nckoi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 40 m 45 sec
Reputation Power: 0
Because the file name is a variable. I do not want to have to code 52 if then statements. The code generates the file name according to the week of the year. I need to display the content of the file (var).

Reply With Quote
  #7  
Old May 24th, 2006, 10:10 PM
ravs ravs is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2006
Location: gurgaon, haryana, india
Posts: 60 ravs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 44 m 29 sec
Reputation Power: 13
Send a message via Yahoo to ravs
ok
ok
lets se once again

you have a variable and you stored dynamicaly generated file name.

is it like this
var x= "http://yourdomain.com/Masterfolder/ChildFolder/Required.Html"

if this then
you can do
var oIfram= document.getElementById("IframeID").src=x

or use this path in XMLHTTPREQUEST it will return you rendered code . from this html page.

Reply With Quote
  #8  
Old May 25th, 2006, 07:43 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,886 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 19 m 35 sec
Reputation Power: 18
I agree, an XMLHTTPREQUEST object would do the trick... but you may want to consider a more solid solution... perhaps without static HTML files... a database and server side language maybe?
__________________
Daryl's Homepage | My Blogroll | My Profile | Firefox supporter!
DevArticles Forum Moderator

"The net is a waste of time, and that's exactly what's right about it." -- William Gibson

Reply With Quote
  #9  
Old May 25th, 2006, 09:57 PM
ravs ravs is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2006
Location: gurgaon, haryana, india
Posts: 60 ravs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 44 m 29 sec
Reputation Power: 13
Send a message via Yahoo to ravs
i also agree with you MadCowDzz, but dont you think, if request is done in conventional so what will be the effect,

1) you have to post your page. that means you are hiting server directly,
2) if the size of requested page is heavy then you page will to able to render untill you requested that page.
3) if we will do this thing then we will try to render two page sat a time. it is not a wise thing. ( i did this in past)
4) you will cache that data in to local machine



BUT


using XMLHTTPREQUEST
you will only get the reruired data.

Reply With Quote
  #10  
Old May 26th, 2006, 07:32 PM
nckoi nckoi is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2006
Posts: 5 nckoi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 40 m 45 sec
Reputation Power: 0
<SCRIPT LANGUAGE="JavaScript" type="text/JavaScript">

var now = new Date();
now.setHours(0,0,0,0);
var days = Math.round(now.valueOf() / 86400000);
var leapoff = Math.ceil((now.getFullYear() - 1972) / 4);
var doy = (days - leapoff) % 365 + 1;
if (doy == 365) {doy = 364};
var wk = Math.floor(doy / 7);
if ((doy % 7) > 0) {wk += 1};
var testing = "test" + eval(wk) + ".htm";


</script>
<body>


<script language="JavaScript" type="text/JavaScript">

window.open(testing)

</script>

I can get it to open in a new window, but need it to open on the existing page.

Reply With Quote
  #11  
Old May 26th, 2006, 11:10 PM
ravs ravs is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2006
Location: gurgaon, haryana, india
Posts: 60 ravs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 44 m 29 sec
Reputation Power: 13
Send a message via Yahoo to ravs
if you want to open on the same page then use


<SCRIPT LANGUAGE="JavaScript" type="text/JavaScript">
Code:
function openPage()
{
var now = new Date();
now.setHours(0,0,0,0); 
var days = Math.round(now.valueOf() / 86400000);
var leapoff = Math.ceil((now.getFullYear() - 1972) / 4);
var doy = (days - leapoff) % 365 + 1;
if (doy == 365) {doy = 364};
var wk = Math.floor(doy / 7);
if ((doy % 7) > 0) {wk += 1}; 
var testing = "test" + eval(wk) + ".htm";
/*IF YOU WANT TO OPEN IT ON THE SAME PAGE*/
window.location.href=testing
/*  IF YOU WANT TO OPEN IT IN IFRAME THEN*/
document.getElementById("IFRAMEID").src=testing

}

</script>

then call this function any where

Reply With Quote
  #12  
Old May 27th, 2006, 09:51 AM
nckoi nckoi is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2006
Posts: 5 nckoi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 40 m 45 sec
Reputation Power: 0
Smile

You da man! Sometimes we can't see the forest for the trees, and need to take a step back and let others ponder the issue. Thanks.

Reply With Quote
  #13  
Old May 30th, 2006, 11:16 AM
ravs ravs is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2006
Location: gurgaon, haryana, india
Posts: 60 ravs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 44 m 29 sec
Reputation Power: 13
Send a message via Yahoo to ravs
we all do mstakes but the best thing is that we should not repeat it.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > Display variable


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap