/    Sign up×
Community /Pin to ProfileBookmark

Script Writer

I need this script to create the code for an HTML page and then display it in a textarea. Whenever I click submit, all values clear, and nothing writes. Please help me.

[COLOR=SlateGray]
<script type=”text/javascript”>
function WriteIt()
{
var day = document.input.day.value
var mon = document.input.mon.value + 1
var year = document.input.year.value

var Lit = document.input.lit.value
var LA = document.input.la.value

var head = “<html><head><title>Homework</title></head><body>Thank you for checking the homework for ” + mon + “/” + day + “/” + year + “.”;

var list = “<u>The homework for today is:</u><br />In Literature:<br />” + Lit + “<br /><br />…and in Language Arts:<br />” + LA + “&nbsp”;

var final = head + list

document.input.output.value = final
}
</script>
<body>
<form name=”input”>
<table width=”50%”>
<tr>
<td bgcolor=”#ABCDAd” width=”20%”><div align=”center”>
Month:<br><input type=”text” name=”mon” size=”2″><br>
Day:<br><input type=”text” name=”day” size=”2″><br>
Year:<br><input type=”text” name=”year” value=”2005″ size=”2″></div>
</td>
<td bgcolor=”#CDEAFB”>
Literature:<br>
<textarea name=”Lit”></textarea><br><br>
Language Arts:<br />
<textarea name=”LA”></textarea>
<br />
<input type=”submit” value=”Create the Code!” onClick=”JavaScript: WriteIt()”>
<br />

</td>
</tr>
<tr>
<td colspan=”2″>
<textarea name=”output” cols=”60″ rows=”8″>This should turn to code!</textarea>
</td>
</tr>
</table>
</body>[/COLOR]

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @dz_boy spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.7,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...