JavaScript Not Work Unless Refresh Page

3 replies
I am replacing html links on an auto generated site with JavaScript links on the fly and writing the JavaScript the links to an external file.

So my web pages have a JavaScript onclick function that is using the link in the external file.

Sometimes when the pages are loaded the links work fine.

Sometimes they do not. Nothing happens. But after refreshing the page, and thus writing to the external file twice - then they work.

Similarly, if I fopen the external file using the 'w' command to reset it, and then write the links to it, the web page links do not work.

But if I refresh the web page then they work again.

Any ideas?

---

Using Internet Explorer when the link does not work I get this error code:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)
Timestamp: Thu, 6 Oct 2011 04:06:34 UTC


Message: Object expected
Line: 190
Char: 1
Code: 0
URI: http://[my web page]


Refresh the page, and the error goes away and the link works fine.

.




.
#javascript #page #refresh #work

Trending Topics