By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,351 Members | 1,270 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,351 IT Pros & Developers. It's quick & easy.

document.write('&timestamp') problem

P: 1
I'm having an issue that I'm sure there is a simple fix for! I'm creating a java script that will dynamically create a URL. In the process I need to include a URL parameter '&timestamp=' followed by an actual timestamp. I noticed that when I use the combination &timestamp under IE 7 the string gets converted to xtamp. This even occurs if I just use document.write('&timestamp'); to write the string out. It results in xtamp! Under a firefox browser the string gets represented correctly.

Any insights would be greatly welcomed!!! Thx
Dec 8 '08 #1
Share this Question
Share on Google+
2 Replies

Expert Mod 5K+
P: 8,639
I'd recommend using the DOM methods instead of document.write(). for standard complient browsers this would be (creating the href-attribute)
Expand|Select|Wrap|Line Numbers
  1. element.setAttribute("href", "href_value");
but IE doesn't fully support that (at least as far as I know), so you need the older DOM methods:
Expand|Select|Wrap|Line Numbers
  1. var HR = document.createAttribute("href");
  2. HR.nodeValue = "href_value";
  3. element.setAttributeNode(HR);
and it's always good practice to escape the ampersand (xhtml parsers will give you an "undefined entity" error, otherwise).

Dec 8 '08 #2

P: 79
yeah... thats correct... IE renders all the time related DOM objects in old fashion. it needs to update the scripting engine. unfortunately they do not do so...

only alternate idea is to have a custom made time stamp.. its a hard task though.. there no other alternative (at least as far as i know)
Dec 9 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.