Qbasicnews.com

Full Version: Javascript
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
is there a way of getting this form
Code:
<html>
<body>
<form action="MAILTO:mikg@ukgateway.net" method="post" enctype="text/plain">

<h3>This form sends an e-mail to Mike Grant</h3>
Name:<br>
<input type="text" name="name"
value="yourname" size="20">
<br>
Mail:<br>
<input type="text" name="mail"
value="yourmail" size="20">
<br>
Background Color: <input type="text" name="T1" size="20">
<p>Text Color: <input type="text" name="T2" size="20"></p>
<p>Amount of Pages: <input type="text" name="T3" size="20"></p>
<p><input type="text" name="T4" size="20">
<br><br>
<input type="submit" value="Send">
<input type="reset" value="Reset">

</p>

</form>
</body>
</html>

to svae to the end of a file. Like the APPEND command in qb. Preferably in html but if not then please in javascript. Because my school don't support php.
huh? I am completely lost :o
Put your code into another HTML file.

Three ways I've got:
1) Virtual include - Add a server side include line that adds this to your html. Your server must support SSI, but most do. Just drop it at the end of your HTML. That would be something like:

<!--#include virtual="form.html"

2) IFRAME - This is poor design, but it is compatible in both MoZilla and IE Browsers now. Opera, too I think. Works just like a frame, so you can customize size, shape, borders, etc.

<IFRAME SRC="form.html">

3) JavaScript include, the kind you probably wanted:

<SCRIPT>
FUNCTION incfile() {
document.write('<script src="form.txt"><\/script>');
}
</SCRIPT>

Just put the HTML into a text file. You can change this so it passes the filename, also, if you plan on including several files with this method. (This is untested, not sure if it's correct)
Potato, not many of those will work.

SSI will work, but it's a server side operation, and has nothing to do with html. You'd need a server with that feature, and those are hard to find in free hosting. the IFRAME solution does work, but in IE only, because it allows Iframes to have its own DOM accessable by IE. You can do that like this:

Code:
x = document.getElementById("myIframe").document.body.innerHTML;
document.getElementById("myDiv").innerHTML = x;
I'm still looking for a way to do this in Netscape. Either way, the most solid solution is to find a server with SSI/PHP/Perl support and use that, because it's foolish to alienate Netscape users, as there's a lot of them.

Oh, and as for the javascript idea, potato, you'd be trying to load the page source as a javascript code block. Wouldn't work at all. What you can do, however, is load a javascript source file that stores a page's html code in a string, and then transfers it into a div or a layer. that makes your pages a pain in the caboose to edit, though.