Languages

Menu
Sites
Language
document.write doesn't work?

Hi,

Im trying to create a list of contacts using javascript. My code sofar looks like this:

<body id= "contacts">
    <div class="ui-page" id="pageIndexScrollbar2">
		<header class="ui-header">
			<h2 class="ui-title">Contacts</h2>
		</header>
		<script type="text/javascript">
		alert("Haidere");
		document.write("<p> Testings</p>")

 

It will show "Haidere" and an ok button. But it will not write Testings on the screen. The whole screen turns black instead.

If I dont use script and write:

<body id= "contacts">
    <div class="ui-page" id="pageIndexScrollbar2">
		<header class="ui-header">
			<h2 class="ui-title">Contacts</h2>
		</header>
		<section class="ui-content">
		<div id="indexscrollbar2"
		     class="ui-indexscrollbar"
		     data-index="A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z">
		</div>
		<p> Testings</p>

then it works. It writes Testings on the screen.

So why doesn't document.write work here? And how can I do this in another way?