Results 1 to 5 of 5

Thread: My webpages show the code, not the page.

  1. #1
    Join Date
    Oct 2010
    Posts
    11
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Exclamation My webpages show the code, not the page.

    Why is my uploaded html document showing as code instead of as a webpage? I put it in the public_html folder (directory). Here is one I uploaded instead of entering directly into a template online. http://www.luxe-bux.com/test.html

    If you view the source, it has all the necessary stuff added. The extra stuff seems to have been added by openoffice or by the file manager that uploaded the file. If I add the extra stuff to my document and re-upload it will it work? It seems like a different problem.

    The first page on the site doesn't show the code, but that is because I edited it within the existing index.html document that the website host provided for me. I need to be able to upload pages.

  2. #2
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    HTML Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 
    <HTML> 
    <HEAD> 
    	<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=iso-8859-1"> 
    	<TITLE></TITLE> 
    	<META NAME="GENERATOR" CONTENT="OpenOffice.org 3.2  (Linux)"> 
    	<META NAME="CREATED" CONTENT="0;0"> 
    	<META NAME="CHANGED" CONTENT="0;0"> 
    	<STYLE TYPE="text/css"> 
    	<!--
    		@page { margin: 0.79in }
    		P { margin-bottom: 0.08in }
    		PRE.cjk { font-family: "Nimbus Mono L", monospace }
    	--> 
    	</STYLE> 
    </HEAD> 
    <BODY LANG="en-US" DIR="LTR"> 
    <PRE CLASS="western">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body onload=&quot;document.notarealform.textfield.focus()&quot;&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
    &lt;!--
    document.write(&quot;&lt;H&gt;A heading&lt;/H&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&quot;);
    function youentered(){
    var item = document.getElementById('item').value;
    document.getElementById('entereditem').innerHTML = item;
    document.getElementById('explanation').innerHTML = 'Your search entry: ';
    }
    function itemresults(){
    var itemField = document.getElementById('item');
    if (itemField.value == &quot;a&quot;) {
    document.getElementById(&quot;show&quot;).innerHTML = &quot;goes with a&quot;;
    } else if (itemField.value == &quot;b&quot;) {
    document.getElementById(&quot;show&quot;).innerHTML = &quot;goes with b&quot;;
    } else if (itemField.value == &quot;&quot;) {
    		document.getElementById(&quot;show&quot;).innerHTML = &quot;goes with c&quot;;
    	} else {
    		document.getElementById(&quot;show&quot;).innerHTML = &quot;goes with d&quot;;
    	}
    }
    //--&gt;
    &lt;/script&gt;
    &lt;table&gt;&lt;tr&gt;&lt;td bgcolor=&quot;f0faf5&quot; id=&quot;show&quot;&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
    &lt;p&gt;&lt;br /&gt;&lt;br /&gt;Enter some text.&lt;p /&gt;
    &lt;p&gt;&lt;i id='explanation'&gt;Your entry: &lt;/i&gt;&lt;b id='entereditem'&gt;none&lt;/b&gt;&lt;/p&gt; 
    &lt;form method=&quot;post&quot; name=&quot;notarealform&quot;&gt;
    &lt;input type='text' name=&quot;textfield&quot; id='item' onkeyup='youentered()' /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
    &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;input type='button' onclick='itemresults()' value='Look It Up'/&gt;&lt;/form&gt;
    &lt;/body&gt;&lt;/html&gt;</PRE> 
    </BODY> 
    </HTML>
    You're trying to publish an office document. As you can see above, all of your code is inside <pre> tags, so it's just displayed literally. You need to type all that code into a plain text editor (gedit, for example) and save the file that way.
    Last edited by traq; 10-16-2010 at 04:50 AM. Reason: edited for clarity

  3. #3
    Join Date
    Oct 2010
    Posts
    11
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    I just made a new notepad document with the same text. I uploaded it and it works for me here: http://www.luxe-bux.com/newtest.txt but it has a .txt extension, and doesn't it need a .html extension instead? I don't think webpages have .txt extensions, so I don't know why that is working.

    I converted that new .txt document to an .html document through an online converter. Then I uploaded it. This one is showing .html instead of .txt, which I think is good. But it just displays the code not the webpage. http://www.luxe-bux.com/newtestb.html

    Sorry, I am a newbie, but isn't notepad supposed to work to get an .html document online?

  4. #4
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    I'm sorry, my post above was misleading. I was showing you the actual code from your page (not what you want!). To get what you want, you need to leave out everything outside of, and including, the <pre> tags, like so:
    HTML Code:
    <html><head></head><body onload="document.notarealform.textfield.focus()">
    <script type="text/javascript">
    <!--
    document.write("<H>A heading</H><br /><br /><br />");
    function youentered(){
    var item = document.getElementById('item').value;
    document.getElementById('entereditem').innerHTML = item;
    document.getElementById('explanation').innerHTML = 'Your search entry: ';
    }
    function itemresults(){
    var itemField = document.getElementById('item');
    if (itemField.value == "a") {
    document.getElementById("show").innerHTML = "goes with a";
    } else if (itemField.value == "b") {
    document.getElementById("show").innerHTML = "goes with b";
    } else if (itemField.value == "") {
    		document.getElementById("show").innerHTML = "goes with c";
    	} else {
    		document.getElementById("show").innerHTML = "goes with d";
    	}
    }
    //-->
    </script>
    <table><tr><td bgcolor="f0faf5" id="show"></td></tr></table>
    <p><br /><br />Enter some text.<p />
    <p><i id='explanation'>Your entry: </i><b id='entereditem'>none</b></p> 
    <form method="post" name="notarealform">
    <input type='text' name="textfield" id='item' onkeyup='youentered()' />&nbsp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp;<input type='button' onclick='itemresults()' value='Look It Up'/></form>
    </body></html>
    As far as saving the file with the proper extension, just enter the extension manually when saving the file: "file.html" instead of "file"

  5. #5
    Join Date
    Oct 2010
    Posts
    11
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    Is there an online tutorial specifically for uploading files that is really thorough and includes troubleshooting? And hopefully free? I've looked around and all I am finding is simple instructions that aren't working. Ideally I want to learn just enough css to be able to create my own stylesheet. I went over the w3 schools tutorial and it didn't seem much harder than html. I want to link a stylesheet to my pages. And I want to do it with notepad or wordpad. But I tried what you said, and even that is not working. Changing the file name without converting it to .html just made it a .txt document online with an extra .html (www.luxe-bux.com/newtest.html.txt) in the name of the file. Any guidance would be appreciated!
    Last edited by asdfqwerty; 10-16-2010 at 05:20 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •