alexfusion
Programmer
Hello Everyone;
I use a script to write HTML in a new window,but I have a problem about the correct syntax.
For instance:
<script language="javascript">
function showwindow()
{
properties="toolbar=no,scroolbars=no,width=200;height=100,
top=100,left=100"
newwindow=window.open("","name",properties)
content=""
content+="<html>"
content+="<head></head>"
content+="<body bgcolor='#FFFFFF'>"
content+="<div align='center'"+">"
content+="This is a child window"
content+="</div>"
content+="</body></html>"
newwindow.document.open()
newwindow.document.write(content)
newwindow.document.close()
}
</script>
<body onload="showwindow()">
Etc.
I would like to know what is the right syntax to write HTML with Javascript.
Do I have to use double quotations for HTML tags an single for HTML atributes or viceversa?
I tried the first way and it works fine.Using the other syntax works OK too when I try it in my own computer.But when I upload the file to a server I get a Javascript syntax error.
I have seen different examples in books and the web using the two ways.
What is the correct syntax?
I'm sorry if this is too long.I dind't know how to explain it.
Can anyone give me some help?
Thanks in advance
alexfusion
mixale@hotmail.com
I use a script to write HTML in a new window,but I have a problem about the correct syntax.
For instance:
<script language="javascript">
function showwindow()
{
properties="toolbar=no,scroolbars=no,width=200;height=100,
top=100,left=100"
newwindow=window.open("","name",properties)
content=""
content+="<html>"
content+="<head></head>"
content+="<body bgcolor='#FFFFFF'>"
content+="<div align='center'"+">"
content+="This is a child window"
content+="</div>"
content+="</body></html>"
newwindow.document.open()
newwindow.document.write(content)
newwindow.document.close()
}
</script>
<body onload="showwindow()">
Etc.
I would like to know what is the right syntax to write HTML with Javascript.
Do I have to use double quotations for HTML tags an single for HTML atributes or viceversa?
I tried the first way and it works fine.Using the other syntax works OK too when I try it in my own computer.But when I upload the file to a server I get a Javascript syntax error.
I have seen different examples in books and the web using the two ways.
What is the correct syntax?
I'm sorry if this is too long.I dind't know how to explain it.
Can anyone give me some help?
Thanks in advance
alexfusion
mixale@hotmail.com