Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

document.write(); not writing???

Status
Not open for further replies.

cryoburned

Programmer
May 23, 2006
14
US
It just doesnt write anything at all...
 
Well - document.write certainly does work, so you must be doing something wrong.

Unfortunately, with less than no detail whatsoever in your post, it's going to be pretty hard to give you any help.

What code do you have? What steps have you taken to debug the problem? What browser(s) do you have the issue in?

Come on - help us to help you and give us something to work with. Saying simply "document.write doesn't work" is clearly unhelpful and incorrect - it's just not working for you with your code.

Dan

Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
well... in both IE and FF document.write("test"); and var myvar = "test"; document.write(test); simply doesn't write. I'm not picking up errors, it just isn't working. I do have javascript enabled aswell.
 
Well - let's make sure you really do have JavaScript enabled, and that it's nothing else on your page that is affectiing the code... because as I've said - document.write does work.

Save this snippet as an HTML file and load it:

Code:
<html>
<head>
	<script type="text/javascript">
		alert('About to write some stuff');
		document.write('some stuff');
		alert('Written stuff!');
	</script>
</head>
<body></body>
</html>

In both IE and Firefox, I see the initial alert, and then I see the text being written followed by the final alert.

What do you see?

If you see neither the alerts or the text, then you've either got JS disabled, or you've got some third party software blocking scripts (some internet security suite, etc), or you've got serious problems with your browser installations, and should look at re-installing them.

If it does work for you, then it points to problems with your existing code - which you've not shown us fully (unless the example you pasted earlier was missing all the structural markup of an HTML file).

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
BRPS's reply reminded me that Windows XP will block scripts on web pages that are run locally, and I haven't found a way yet to allow them automatically. Typically there's a warning message somewhere in the browser window that the script has been blocked, and you have to go through a couple steps to allow scripts to run on that page.

Lee
 
sorry guys.. i've been away.. but yes the code you gave me did work, and i finnaly resolved my problem. I was was subtracting a sttring from an integer.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top