473,668 Members | 2,423 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting 2 scripts to run on the same webpage

I have 2 scipts that I am trying to get to run on the same page. One
is a time/date script, the other is a countdown script (i.e. countdown
days, hours, mins until a given date). They both work independent of
each other, however, when both are on the page, the "active clock"
does not work. I am assuming it is because some of the variables are
the same???

Can anyone help please?!?!
Here are the 2 scripts:
**Active Clock that displays current time/date info**
<!-- Begin
var dayarray=new Array("Sunday", "Monday","Tuesd ay","Wednesday" ,"Thursday","Fr iday","Saturday ")
var montharray=new Array("January" ,"February","Ma rch","April","M ay","June","Jul y","August","Se ptember","Octob er","November", "December")
function getthedate(){
var mydate=new Date()
var year=mydate.get Year()
if (year < 1000)
year+=1900
var day=mydate.getD ay()
var month=mydate.ge tMonth()
var daym=mydate.get Date()
if (daym<10)
daym="0"+daym
var hours=mydate.ge tHours()
var minutes=mydate. getMinutes()
var seconds=mydate. getSeconds()
var dn="AM"
if (hours>=12)
dn="PM"
if (hours>12){
hours=hours-12
}
{
d = new Date();
Time24H = new Date();
Time24H.setTime (d.getTime() + (d.getTimezoneO ffset()*60000) +
3600000);
InternetTime = Math.round((Tim e24H.getHours() *60+Time24H.get Minutes())
/ 1.44);
if (InternetTime < 10) InternetTime = '00'+InternetTi me;
else if (InternetTime < 100) InternetTime = '0'+InternetTim e;
}
if (hours==0)
hours=12
if (minutes<=9)
minutes="0"+min utes
if (seconds<=9)
seconds="0"+sec onds
//change font size here
var cdate=dayarray[day]+", "+montharra y[month]+" "+daym+" "+year+" |
"+hours+":"+min utes+" "+dn+" "
if (document.all)
document.all.cl ock.innerHTML=c date
else if (document.getEl ementById)
document.getEle mentById("clock ").innerHTML=cd ate
else
document.write( cdate)
}
if (!document.all& &!document.getE lementById)
getthedate()
function goforit(){
if (document.all|| document.getEle mentById)
setInterval("ge tthedate()",100 0)
}
window.onload=g oforit

// End -->
And the 2nd script - ****Countdown until given date*****
function setcountdown(th eyear,themonth, theday){
yr=theyear;mo=t hemonth;da=thed ay
}

//////////CONFIGURE THE COUNTDOWN SCRIPT HERE//////////////////

//STEP 1: Configure the countdown-to date, in the format year, month,
day:
setcountdown(20 04,12,25)

//STEP 2: Change the two text below to reflect the occasion, and
message to display on that occasion, respectively
var occasion="Chris tmas!"
var message_on_occa sion="Merry Christmas!"

//STEP 3: Configure the below 5 variables to set the width, height,
background color, and text style of the countdown area
var countdownwidth= '480px'
var countdownheight ='20px'
var countdownbgcolo r='white'
var opentags='<font face="Arial" size="4" color="red"><sm all>'
var closetags='</small></font>'

//////////DO NOT EDIT PASS THIS LINE//////////////////

var montharray=new Array("Jan","Fe b","Mar","Apr", "May","Jun","Ju l","Aug","Sep", "Oct","Nov","De c")
var crosscount=''

function start_countdown (){
if (document.layer s)
document.countd ownnsmain.visib ility="show"
else if (document.all|| document.getEle mentById)
crosscount=docu ment.getElement ById&&!document .all?document.g etElementById(" countdownie")
: countdownie
countdown()
}

if (document.all|| document.getEle mentById)
document.write( '<span id="countdownie "
style="width:'+ countdownwidth+ ';
background-color:'+countdo wnbgcolor+'"></span>')

window.onload=s tart_countdown
function countdown(){
var today=new Date()
var todayy=today.ge tYear()
if (todayy < 1000)
todayy+=1900
var todaym=today.ge tMonth()
var todayd=today.ge tDate()
var todayh=today.ge tHours()
var todaymin=today. getMinutes()
var todaysec=today. getSeconds()
var todaystring=mon tharray[todaym]+" "+todayd+", "+todayy+"
"+todayh+":"+to daymin+":"+toda ysec
futurestring=mo ntharray[mo-1]+" "+da+", "+yr
dd=Date.parse(f uturestring)-Date.parse(toda ystring)
dday=Math.floor (dd/(60*60*1000*24) *1)
dhour=Math.floo r((dd%(60*60*10 00*24))/(60*60*1000)*1)
dmin=Math.floor (((dd%(60*60*10 00*24))%(60*60* 1000))/(60*1000)*1)
dsec=Math.floor ((((dd%(60*60*1 000*24))%(60*60 *1000))%(60*100 0))/1000*1)
//if on day of occasion
if(dday<=0&&dho ur<=0&&dmin<=0& &dsec<=1&&today d==da){
if (document.layer s){
document.countd ownnsmain.docum ent.countdownns sub.document.wr ite(opentags+me ssage_on_occasi on+closetags)
document.countd ownnsmain.docum ent.countdownns sub.document.cl ose()
}
else if (document.all|| document.getEle mentById)
crosscount.inne rHTML=opentags+ message_on_occa sion+closetags
return
}
//if passed day of occasion
else if (dday<=-1){
if (document.layer s){
document.countd ownnsmain.docum ent.countdownns sub.document.wr ite(opentags+"O ccasion
already passed! "+closetags )
document.countd ownnsmain.docum ent.countdownns sub.document.cl ose()
}
else if (document.all|| document.getEle mentById)
crosscount.inne rHTML=opentags+ "Occasion already passed! "+closetags
return
}
//else, if not yet
else{
if (document.layer s){
document.countd ownnsmain.docum ent.countdownns sub.document.wr ite(opentags+dd ay+
" days, "+dhour+" hours, "+dmin+" minutes, and "+dsec+" seconds left
until "+occasion+clos etags)
document.countd ownnsmain.docum ent.countdownns sub.document.cl ose()
}
else if (document.all|| document.getEle mentById)
crosscount.inne rHTML=opentags+ dday+ " days, "+dhour+" hours, "+dmin+"
minutes, and "+dsec+" seconds left until "+occasion+clos etags
}
setTimeout("cou ntdown()",1000)
}
Jul 23 '05 #1
12 1660
"Mary Catherine" <Ma************ *@gmail.com> wrote in message
news:58******** *************** ***@posting.goo gle.com...
I have 2 scipts that I am trying to get to run on the same page. One
is a time/date script, the other is a countdown script (i.e. countdown
days, hours, mins until a given date). They both work independent of
each other, however, when both are on the page, the "active clock"
does not work. I am assuming it is because some of the variables are
the same???


[snip]

"montharray " is declared twice.

var montharray=new
Array("January" ,"February","Ma rch","April","M ay","June","Jul y","August","Se p
tember","Octobe r","November"," December")

var montharray=new
Array("Jan","Fe b","Mar","Apr", "May","Jun","Ju l","Aug","Sep", "Oct","Nov","De c
")
Jul 23 '05 #2
JRS: In article <hPMkd.86544$R0 5.20332@attbi_s 53>, dated Thu, 11 Nov
2004 16:54:37, seen in news:comp.lang. javascript, McKirahan
<Ne**@McKirahan .com> posted :
"Mary Catherine" <Ma************ *@gmail.com> wrote in message
news:58******* *************** ****@posting.go ogle.com...
I have 2 scipts that I am trying to get to run on the same page. One
is a time/date script, the other is a countdown script (i.e. countdown
days, hours, mins until a given date). They both work independent of
each other, however, when both are on the page, the "active clock"
does not work. I am assuming it is because some of the variables are
the same???


[snip]

"montharray " is declared twice.

var montharray=new
Array("January ","February","M arch","April"," May","June","Ju ly","August","S ep
tember","Octob er","November", "December")

var montharray=new
Array("Jan","F eb","Mar","Apr" ,"May","Jun","J ul","Aug","Sep" ,"Oct","Nov","D ec
")


That's undesirable, but does no harm.

The OP's code is not indented for structure, and therefore not worth
reading in full. However :-

For a clock, setTimeout(..., 1000) is unsuitable; see
<URL:http://www.merlyn.demo n.co.uk/js-date0.htm#TaI>

var year=mydate.get Year() ; if (year < 1000) year+=1900
will fail on browsers which give the sequence 97,98,99,00,01 ; such
were said to exist. Use getFullYear or a substitute :
<URL:http://www.merlyn.demo n.co.uk/js-date0.htm#gFY>, getFY() .

InternetTime appears to be an estimate of Central European Standard
Time; but it seems not to be used.

The countdown will not allow for Summer Time transitions; users will
expect an integer number of days between 25 Jun 0000h and 25 Dec 0000h.

The programmer should have modularised the code, Leading Zero being an
example.

--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.c om/faq/> JL/RC: FAQ of news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 23 '05 #3
On 11 Nov 2004 08:42:53 -0800, Mary Catherine <Ma************ *@gmail.com>
wrote:
I have 2 scipts that I am trying to get to run on the same page. One is
a time/date script, the other is a countdown script (i.e. countdown
days, hours, mins until a given date). They both work independent of
each other, however, when both are on the page, the "active clock" does
not work. I am assuming it is because some of the variables are the
same???
Whilst some identifiers do clash, I doubt that has much of an impact. The
biggest problem is that both try to assign a function to the document's
load event handler, resulting in the second block of code replacing the
first's starting function.
Can anyone help please?!?!


Certainly. The first thing is to bin the scripts you presented. I
apologise if you authored them, but they are badly written (the fact
you've had problems proves that), bloated, and inefficient.

I've written replacements, but as the second block of code wouldn't
execute (perhaps you didn't post part of it), I've had to guess at what it
did. The same is true, to an extent with the first: I was unable to see
what the author was trying to achieve with the getTimezoneOffs et part of
the script, so I ignored that. If they don't produce what you expected,
please describe in detail what should occur.

A demo can be found at
<URL:http://www.mlwinter.pw p.blueyonder.co .uk/clj/catherine/time.html>. It
will be deleted in about a week. There are three script files; two for the
functions, and a third which contains some library code of mine.

There is an important caveat to using this code[1], with the events code
in particular. If you need to add code to be fired when the page loads, do
*not* write

<body ... onload="...">

The code I've presented will be interferred with, and it will stop
working. Instead, write

dom.events.addE ventListener(th is, 'load', function() {
/* Your code here. */
});

in a script block.

Similarly, don't write

window.onload = funcName;

Use

dom.events.addE ventListener(th is, 'load', funcName);

instead. This might mean you need to change other scripts.

The reason, if you're interested, is that the events library code creates
a function, a dispatcher, which is added as an event listener. When you
add your own event listeners, the dispatcher adds it to an internal list
and, when the event is fired, it calls all of the functions in this list.
This allows you to add multiple event listeners to the same element[2].

Please be aware that I classify the library code as a beta version: you
may find bugs. If you read this post Dr Stockton, I'd be interested to
know if IE4 runs the demo properly.

[snipped code]

If you post here again with more code, could I make a request? Please
either manually wrap the code to about 70 characters wide, or place a
demonstration online and link to it (preferred). There were numerous
syntax errors where your newsreader automatically wrapped the code. String
literals split across lines, single line comments on two lines, etc. This
makes a debugging effort harder.

Hope that helps,
Mike
[1] Aside from the obvious one: don't pretend you wrote it. :)
[2] The W3C DOM provides this functionality too, which is used if
available, but browsers like IE need this emulation.

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #4
Dr John Stockton <sp**@merlyn.de mon.co.uk> wrote in message news:<u1******* *******@merlyn. demon.co.uk>...
JRS: In article <hPMkd.86544$R0 5.20332@attbi_s 53>, dated Thu, 11 Nov
2004 16:54:37, seen in news:comp.lang. javascript, McKirahan
<Ne**@McKirahan .com> posted :
"Mary Catherine" <Ma************ *@gmail.com> wrote in message
news:58******* *************** ****@posting.go ogle.com...
I have 2 scipts that I am trying to get to run on the same page. One
is a time/date script, the other is a countdown script (i.e. countdown
days, hours, mins until a given date). They both work independent of
each other, however, when both are on the page, the "active clock"
does not work. I am assuming it is because some of the variables are
the same???


[snip]

"montharray " is declared twice.

var montharray=new
Array("January ","February","M arch","April"," May","June","Ju ly","August","S ep
tember","Octob er","November", "December")

var montharray=new
Array("Jan","F eb","Mar","Apr" ,"May","Jun","J ul","Aug","Sep" ,"Oct","Nov","D ec
")


That's undesirable, but does no harm.

The OP's code is not indented for structure, and therefore not worth
reading in full. However :-

For a clock, setTimeout(..., 1000) is unsuitable; see
<URL:http://www.merlyn.demo n.co.uk/js-date0.htm#TaI>

var year=mydate.get Year() ; if (year < 1000) year+=1900
will fail on browsers which give the sequence 97,98,99,00,01 ; such
were said to exist. Use getFullYear or a substitute :
<URL:http://www.merlyn.demo n.co.uk/js-date0.htm#gFY>, getFY() .

InternetTime appears to be an estimate of Central European Standard
Time; but it seems not to be used.

The countdown will not allow for Summer Time transitions; users will
expect an integer number of days between 25 Jun 0000h and 25 Dec 0000h.

The programmer should have modularised the code, Leading Zero being an
example.


*************** ********
I will take a look at your suggestions and see if that works. Thanks!
MC
Jul 23 '05 #5
JRS: In article <opshckp2nqx13k vk@atlantis>, dated Fri, 12 Nov 2004
10:27:03, seen in news:comp.lang. javascript, Michael Winter <M.Winter@bl
ueyonder.co.inv alid> posted :
A demo can be found at
<URL:http://www.mlwinter.pw p.blueyonder.co .uk/clj/catherine/time.html>. It
will be deleted in about a week. There are three script files; two for the
functions, and a third which contains some library code of mine. ... Please be aware that I classify the library code as a beta version: you
may find bugs. If you read this post Dr Stockton, I'd be interested to
know if IE4 runs the demo properly.


I've not worked out exactly what it should do.

It displays, in my IE4 :

If you want to style the text below, use CSS. You can use the id
attribute values as selectors.

Friday, 12 November 2004 23:46
There are approximately 41 days, 0 hours, and 13 minutes until
Christmas

then twice gives a script error message box, approximately :

Line: 1
Char: 1
Error: Object expected
Code: 0

Suggestion : the countdown, for demo purposes, should show seconds;
otherwise it takes a long time to tell that nothing happens.


From reading the thread, I suspect that an adapted subset of <URL:http:
//www.merlyn.demo n.co.uk/js-date2.htm#RC> would do what is wanted;
/inter alia/, it shows a running DoW YYYY-MM-DD hh:mm:ss local clock
and a countdown in Days + hh:mm:ss to the nearest Christmas noon
(i.e., IIRC, at Christmas noon each year it jumps 365/6 days).

By using new Date(+N) at least part of the code is made valid for
the years -68 to +99, or so my comment implies. Admittedly, Christmas
is not applicable in negative years; and no future Christmas is numbered
less than 2004.

Note that the page uses one setTimeout for both YMDhms clock and
countdown, and another for JDN & suchlike.

--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.c om/faq/> JL/RC: FAQ of news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 23 '05 #6
On Sat, 13 Nov 2004 16:08:23 +0000, Dr John Stockton
<sp**@merlyn.de mon.co.uk> wrote:

[snip]
I've not worked out exactly what it should do.
Sorry. The "first" line should display the current time. The "second"
should display a countdown, currently set to 2004-12-25 00:00 (though it
would have been the 24th when you saw it).

Just to note, the reason for the lack of synchronisation between the two
outputs is that they are calculated separately, rather than being linked
to the same Date object. They could be combined, but should one need to be
separated from the other, it would burden the user.
It displays, in my IE4 :

If you want to style the text below, use CSS. You can use
the id attribute values as selectors.

Friday, 12 November 2004 23:46
There are approximately 41 days, 0 hours, and 13 minutes
until Christmas
That's promising...
then twice gives a script error message box, approximately :

Line: 1
Char: 1
Error: Object expected
Code: 0
....but that's confusing. I was worried that IE4 might object to something,
probably due to the type of patterns used. The result I was expecting was
either no problems at all, or total failure. Seems to be neither. Of
course, Microsoft's infamous script debugging messages don't really help
narrow down the cause.

The other cause of concern was the library code used, including a modified
version of DynWrite (dom.write), has never been used in IE4 as far as I
know.
Suggestion : the countdown, for demo purposes, should show seconds;
otherwise it takes a long time to tell that nothing happens.
True. I had that when I was testing the code, but removed it before
uploading. I've restored it. I also added links to the scripts (though
that may not be useful with IE).
From reading the thread, I suspect that an adapted subset of
<URL:http://www.merlyn.demo n.co.uk/js-date2.htm#RC> would do what is
wanted;
That's what's effectively happened. As an afterthought, I decided to look
at your site, particularly as you corrected me on a related matter in the
past. The code is comparable, with the only part of note that's missing is

D += (N.getTimezoneO ffset()-X.getTimezoneOf fset())*60000 // ST

from the function, ReptNow. To be honest, I don't see the point in it.
Surely the timezone in both Date objects will be identical, so you'll
always add zero. I must be missing something.

[snip]
(i.e., IIRC, at Christmas noon each year it jumps 365/6 days).


That's what I see from reading the code.

[snip]

Thank you for looking,
Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #7
JRS: In article <opshey5aaax13k vk@atlantis>, dated Sat, 13 Nov 2004
17:32:39, seen in news:comp.lang. javascript, Michael Winter <M.Winter@bl
ueyonder.co.inv alid> posted :
As an afterthought, I decided to look
at your site, particularly as you corrected me on a related matter in the
past. The code is comparable, with the only part of note that's missing is

D += (N.getTimezoneO ffset()-X.getTimezoneOf fset())*60000 // ST

from the function, ReptNow. To be honest, I don't see the point in it.
Surely the timezone in both Date objects will be identical, so you'll
always add zero. I must be missing something.


Comment ST. N is today, and X is Christmas. In Summer Time, D is a
one-hour adjustment. That's for civil days displayed.

(i.e., IIRC, at Christmas noon each year it jumps 365/6 days).


That's what I see from reading the code.


Good. I don't recall whether I ever watched it happen. But on second
thoughts, it should change at 00:00 on the 25th, because of variable Z.
By the way, I control NewPix with Limits to be SURE that the page cannot
ever continuously fetch images from the server. If it can be confirmed
that GetFigs() actually fetches the ten GIFs, and NewPix() does not
cause Web access, I can remove Limits.

--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.c om/faq/> JL/RC: FAQ of news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 23 '05 #8
On Sun, 14 Nov 2004 14:01:13 +0000, Dr John Stockton
<sp**@merlyn.de mon.co.uk> wrote:
JRS: In article <opshey5aaax13k vk@atlantis>, dated Sat, 13 Nov 2004
17:32:39, seen in news:comp.lang. javascript, Michael Winter
<M.******@bluey onder.co.invali d> posted :
[snip]
D += (N.getTimezoneO ffset()-X.getTimezoneOf fset())*60000 // ST
[snip]
In Summer Time, D is a one-hour adjustment. [...]
Of course!
(i.e., IIRC, at Christmas noon each year it jumps 365/6 days).


That's what I see from reading the code.


Good. I don't recall whether I ever watched it happen. But on second
thoughts, it should change at 00:00 on the 25th, because of variable Z.


I suppose it depends on your aims. In the OP's case, the target date
requires a special case message. At present my code should display the
message for exactly twenty-four hours (must admit I haven't actually
tested that, though). After that, nothing is displayed, but it could be
changed to start the countdown again.
By the way, I control NewPix with Limits to be SURE that the page cannot
ever continuously fetch images from the server.


I don't think you could ever guarantee that. If the user agent doesn't
cache the images due to browser settings, they will be retrieved
constantly.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #9
"Michael Winter" <M.******@bluey onder.co.invali d> wrote in message news:<opshckp2n qx13kvk@atlanti s>...
On 11 Nov 2004 08:42:53 -0800, Mary Catherine <Ma************ *@gmail.com>
wrote:
I have 2 scipts that I am trying to get to run on the same page. One is
a time/date script, the other is a countdown script (i.e. countdown
days, hours, mins until a given date). They both work independent of
each other, however, when both are on the page, the "active clock" does
not work. I am assuming it is because some of the variables are the
same???


Whilst some identifiers do clash, I doubt that has much of an impact. The
biggest problem is that both try to assign a function to the document's
load event handler, resulting in the second block of code replacing the
first's starting function.
Can anyone help please?!?!


Certainly. The first thing is to bin the scripts you presented. I
apologise if you authored them, but they are badly written (the fact
you've had problems proves that), bloated, and inefficient.

I've written replacements, but as the second block of code wouldn't
execute (perhaps you didn't post part of it), I've had to guess at what it
did. The same is true, to an extent with the first: I was unable to see
what the author was trying to achieve with the getTimezoneOffs et part of
the script, so I ignored that. If they don't produce what you expected,
please describe in detail what should occur.

A demo can be found at
<URL:http://www.mlwinter.pw p.blueyonder.co .uk/clj/catherine/time.html>. It
will be deleted in about a week. There are three script files; two for the
functions, and a third which contains some library code of mine.

There is an important caveat to using this code[1], with the events code
in particular. If you need to add code to be fired when the page loads, do
*not* write

<body ... onload="...">

The code I've presented will be interferred with, and it will stop
working. Instead, write

dom.events.addE ventListener(th is, 'load', function() {
/* Your code here. */
});

in a script block.

Similarly, don't write

window.onload = funcName;

Use

dom.events.addE ventListener(th is, 'load', funcName);

instead. This might mean you need to change other scripts.

The reason, if you're interested, is that the events library code creates
a function, a dispatcher, which is added as an event listener. When you
add your own event listeners, the dispatcher adds it to an internal list
and, when the event is fired, it calls all of the functions in this list.
This allows you to add multiple event listeners to the same element[2].

Please be aware that I classify the library code as a beta version: you
may find bugs. If you read this post Dr Stockton, I'd be interested to
know if IE4 runs the demo properly.

[snipped code]

If you post here again with more code, could I make a request? Please
either manually wrap the code to about 70 characters wide, or place a
demonstration online and link to it (preferred). There were numerous
syntax errors where your newsreader automatically wrapped the code. String
literals split across lines, single line comments on two lines, etc. This
makes a debugging effort harder.

Hope that helps,
Mike
[1] Aside from the obvious one: don't pretend you wrote it. :)
[2] The W3C DOM provides this functionality too, which is used if
available, but browsers like IE need this emulation.


*************** *****
Thanks! Ive looked at the files you've linked for me. I did not write
these files, as js is something I am SLOWLY learning to do. They are,
rather, scripts the former web 'developer' either wrote or got
somewhere.

Thank you for the link you posted. I will save these and take a look
at
them tomorrow when I have more time for 'time wasting activities' as
Ive
been told they are called.

Thanks again everyone - even though 1/2 the conversation was way over
my little blonde head! Im sure with enough time and patience, I'll be
able
to figure out whats going on here!
Jul 23 '05 #10

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

Similar topics

2
3321
by: Chris | last post by:
I am running an ASP script which I require to get the source html from some URL so I can pick out bits of this and include the data in my webpage. So it should have a function something like this: Function GetHTMLSource(String URL) which retuns the source for example as a string or an array of strings I'm not sure how to tackle getting the html source. I've tried setting up an Internet Explorer object and also using the
12
2703
by: David Walker | last post by:
Hi I have a program which I need to interface with a webpage - the webpage will accept an input (probably a 'post' string from the program) and then will process it and needs to return a value. Is there an easy way to interface the program to do this? I have two questions: How can I call a webpage as simply as possible in c / c++ (preferably not using MFC etc) and pass a 'post' string to the page? How can I retrieve an array of values...
12
1779
by: Adam Lipscombe | last post by:
Folks, I need to get the contents of a form attribute. In Read/Write mode this is field, so I can use getElementById("name").value In ReadOnly this is just plain text, so I can use getElementById("name").innerText. I need to do it dynamically though, so is there anyway I can look at the object returned by getElementById() and determine if it was a field or a
2
2921
by: Van der Weij | last post by:
Hi, I want to preload some images for a webpage _and_ determing their width and height. The problem is that the scripts continue while the images are loaded in the background, while I need the thus undefined values of image.width and image.height. Thus I'm looking for a function which stops executing my script until the images are all fully loaded.
0
1346
by: balukrishnan | last post by:
Hi... I am trying to create an object of Shdocvw.InternetExplorer class, using which I need to launch a particular URL(A JSP Webpage). Then I need to get the document of the page loaded. But while doing so, I encounter an Invalid cast exception for some properties of the document like frames, parent window, scripts and location. I also need to execute a script on this JSP. While doing so, this exception comes out. How can I overcome this?...
9
1521
by: =?Utf-8?B?UmF5?= | last post by:
Have SQL server on one machine. Have IIS on another machine in same large intranet. Have website in IIS with Basic Authentication turned on and other options deselected. Have webpage (.aspx) with following connection in the web.config file <add name="NorthwindConnectionString1" connectionString="Data Source=VHAV16PLAN1;Initial Catalog=Northwind;Integrated Security=SSPI" providerName="System.Data.SqlClient" /> Have following added to...
9
6202
by: loretta | last post by:
This code is just reading html and printing , eventually I want to modify the html. However, the original html contains javascript and the output html contains tags not in the original. $url = "http://www.something.com"; $doc = new DOMDocument(); $doc->loadHTMLFile($url); print $doc->saveHTML(); Original html snippet:
2
3566
by: rustyc | last post by:
Well, here's my first post in this forum (other than saying 'HI' over in the hi forum ;-) As I said over there: ... for a little side project at home, I'm writing a ham radio web site in uby/Rails. I started it in Perl and gave up on Perl as I went from the 'display the database information on the web page' to the 're-display the information from the database and allow the user to update the database using the web page' stage and realized...
6
1399
denny1824
by: denny1824 | last post by:
On the webpage I use a view to fill a dataset. strCommand = "Select * from view" objConnection = New SqlClient.SqlConnection(strconnect) objCommand = New SqlClient.SqlDataAdapter(strCommand, objConnection) objCommand.Fill(dsDataSet, "view") This worked fine until the DBA messed up the view. Then my page got an error when it tried to do the fill. I need a way for my webpage to detect if the view is good or bad before getting an error...
0
8382
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
8893
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
8802
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
8658
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
7405
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
6209
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
4206
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...
0
4384
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1787
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.