Please can you help me. I am new to web design and html. I have a java script code in html and need help as i do not know how to insert it into my current webpage. I have tried but it do not work. All it does is show the coding on the actual page when viewed in IE.
Look forward to receiving your help.
Andy
What I think you have done here is put your script in the body section without declaring script type, therefore the browser renders it as HTML rather than an active script. For example:
<body>
document.write("<h1>This is a header</h1>");
document.write("<p>This is a paragraph</p>");
document.write("<p>This is another paragraph</p>");WONT WORK and will display in the browser.
However...
<body>
<script type="text/javascript">
{
document.write("<h1>This is a header</h1>");
document.write("<p>This is a paragraph</p>");
document.write("<p>This is another paragraph</p>");
}
</script></body>
WILL WORK! Ensure that you have wrapped your script in the appropriate tags as above or the browser wont recognise the script.
:0)
255 views
Usually answered in minutes!
Do you have any example source code?
As far as the text showing up in the browser, you need to place the actual code inside comments:
Example:
×