Hi,
i would like to create an html generator.
I have a form for user to key in the info. One of the textbox for user to key in heading. after user key in the heading and generate the html. The output is sth like
…..
<h1>Heading</h1>
…
What i would like to improve is to let user to select the font size so that if the user select different font size. It will output the html code look sth like
<h1>[COLOR=”Red”]<font size=”14″>[COLOR=”Red”]</font>
….
Here is my java scripts
[code]
<script type=”text/javascript”>
function generateCode(form){
//Header
title = document.inputForm.title.value;
metaDescription = document.inputForm.metaDescription.value;
metaKeywords = document.inputForm.metaKeywords.value;
//Website Content
headingtext = document.inputForm.headingtext.value;
tagline = document.inputForm.tagline.value;
subtagline = document.inputForm.subtagline.value;
output =
‘<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.1//EN” “http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd”>n’ +
‘<html>n’ +
‘<head>n’ +
‘<title>n’ +
((title) ? ” + title : ”) + ‘</title>n’ +
((metaKeywords) ? ‘<meta name=”keywords” content=”‘ + metaKeywords + ‘”>n’ : ”) +
((metaDescription) ? ‘<meta name=”description” content=”‘ + metaDescription + ‘”>n’ : ”) +
‘<meta name=”revisit-after” content=”7 Days” />n’ +
‘<meta name=”robots” content=”index,follow” />n’ +
‘<link rel=”stylesheet” type=”text/css” href=”default.css” media=”screen”/>n’ +
‘<body>n’ +
((headingtext) ? ‘<h1>’ + headingtext + ‘</h1><br/>n’ : ”) +
((tagline) ? ‘<h2>’ + tagline + ‘</h2><br/>n’ : ”) +
((subtagline) ? ‘<h3>’ + subtagline + ‘</h3><br/>n’ : ”) +
‘</body>n’ +
‘</html>n’;
document.inputForm.source.value = output;
return output;
}
function preview() {
var htmlCode;
htmlCode = generateCode();
targetURL = “/preview/preview.cfm?htmlCode=” + htmlCode;
window.open(targetURL, “newWindow”, “width=500,height=400,top=100,left=100,toolbar=no,menubar=no,location=no,scrollbars=yes”);
}
</script>
Hope i can get help here.
i am testing my code here [url]www.malaysia-tractors.com