Problem ze skryptem

Wszystko związane ze skryptami JS, DHTML itd.
Awatar użytkownika
dudus1824
Posty: 166
Rejestracja: 28 kwie 2009, 19:40:12
Strona na CBA.pl: http://www.dudus1824.c0.pl/
Lokalizacja: Gostynin
Płeć: Mężczyzna
User Agent: Firefox Windows 800x600

Problem ze skryptem

Post autor: dudus1824 »

mam oto taki mini generator loga

Kod: Zaznacz cały

<!DOCTYPE html 
    PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl" lang="pl">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" />
<meta http-equiv="Content-Language" content="pl" />
<title>Generator</title>


<script type="text/javascript">

function generuj
{
    html +=
        '<div class="logo"> \n' +
        '<font size="5"><center>'+document.getElementById('title').value;</center></font>n' +
        '<font size="3">'+document.getElementById('motto').value;</font>\n' +
        '</div>';
    
}


</script>
</head>
<body>

<h1 style="text-align: center">Generator loga</h1><hr />

<br /><br />


<form action="javascript:void(0)" onsubmit="generuj(this); return false" onreset="if (window.confirm('Czy na pewno chcesz wyczyścić wszystkie dane?')) { window.location.reload() } else return false">
<table style="margin-left: auto; margin-right: auto">
<tr>
<th class="col">Tytuł:</th>
<td><input type="text" name="title" class="long" /></td>
</tr>
<tr>
<th class="col">Opis:</th>
<td><input type="text" name="motto" class="long" /></td>
</tr>
<tr class="tfoot">
<td colspan="2"><input type="submit" value="Generuj" class="generuj" />
<input type="reset" value="Wyczyść" /></td></tr>
</table>

<hr />
<fieldset>
<legend>index.html</legend>
<textarea name="html" cols="50" rows="10" style="width: 100%" readonly="readonly" onfocus="this.select()"></textarea>
<div style="text-align: right"><input type="button" value="Zaznacz wszystko" style="font-size: 12px" onclick="this.form.elements['html'].select(); this.form.elements['html'].focus()" /></div>
</fieldset>

</form>


</body>
</html>
Ale nie działa proszę o pomoc

---- EDIT ----

Może '+document.getElementById('title').value; czymś zastąpić
kryzz
Posty: 438
Rejestracja: 26 sty 2008, 09:05:13
Płeć: Niewybrana
User Agent: Firefox Windows 1280x1024

Re: Problem ze skryptem

Post autor: kryzz »

Na przyszłość ;p
Jak pobierasz przez identyfikator, to go trzeba ustawić na stronie ;p

Kod: Zaznacz cały

<input type="text" name="title" id="title" class="long" /> 
ODPOWIEDZ