473,473 Members | 1,714 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

document.write sintax ?

Recently writing some code i cross over a problem using document.write:

The code
<input name="e2" size="20" type="text">
<select name="e1">
<option>........................................ .
<option>Option1
</select>
<input src="picture.gif" onclick="I()" align="right" type="image" width="60"
height="49"></p>

<script type="text/javascript">
function I()
{
if(e2.value=="")
document.write("Please input some words")
else if (e1.selectedIndex==0)
document.write("please choose some option")
}

The problem:

Is there a way to write this inside a div without using the innerHTML
command , or to fix the structure above, the current one dissapears using
document write , Thank you for all the atencion given to the subject.

Jul 23 '05 #1
2 1193
In article <41***********************@news.telepac.pt>, of**@hotmail.com
enlightened us with...

The problem:

Is there a way to write this inside a div without using the innerHTML
command , or to fix the structure above, the current one dissapears using
document write , Thank you for all the atencion given to the subject.


The DOM way is to use createElement and appendChild instead of
document.write.
Try those.

--
--
~kaeli~
Humpty Dumpty was pushed!
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #2

"kaeli" <ti******@NOSPAM.comcast.net> escreveu na mensagem
news:MP************************@nntp.lucent.com...
In article <41***********************@news.telepac.pt>, of**@hotmail.com
enlightened us with...

The problem:

Is there a way to write this inside a div without using the innerHTML
command , or to fix the structure above, the current one dissapears using
document write , Thank you for all the atencion given to the subject.


The DOM way is to use createElement and appendChild instead of
document.write.
Try those.

--
--
~kaeli~
Humpty Dumpty was pushed!
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Well I came up witH:

<script type="text/javascript">
e2=document.createElement("<input name='e2' size='20' type='text'
align='center'>")
e1=document.createElement('<select name="e1"
align="center"><option>.........<option>option1</select>')
search=document.createElement('<input src="picture.gif" onclick="I()"
align="right" type="image" width="60" height="49">')

function I()
{
if(e2.value=="")
e2.appendChild("please insert text");
else if (e1.selectedIndex==0)
e2.appendChild("please insert an option")

somehow createElement do not create the input.

}
</script>
Jul 23 '05 #3

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

Similar topics

2
by: Brett Baisley | last post by:
Hello I have a block of html code that I want to run by calling a javascript function to print it. Its basically a table with menu items in it that is the same for many pages, and instead of...
10
by: Frits JK | last post by:
Hallo, I have to write a GUID to the register but I don't know to convert to hexadecimal. I have tried several things but I am shore that line 5 and 6 are not correct....
1
by: simon | last post by:
This works in VB: <td <%# myFunction(DataBinder.Eval(Container.DataItem,"column1"))%>> but in C# doesn't. What is the right sintax to include some text between the html tag in C#? I can't...
7
by: InuY4sha | last post by:
Hi all :) sorry.. I know this is a very mean question but I can't get the following couple of lines: static int dev_init(struct net_device *dev); struct net_device my_device = { init: dev_init,...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...
0
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...
0
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...
1
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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...

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.