You are here: Re: Maths in HTML « HTML « IT news, forums, messages
Re: Maths in HTML

Posted by Toby Inkster on 01/04/07 14:50

Geoff wrote:

> Can this be done in HTML alone

No -- you will need some form of scripting. There are basically two
options:

- Client side (using Javascript)
- Server side (big choice of scripting languages)

Client side is very easy, but not completely reliable, as not everyone
uses Javascript-enabled browsers. Here's a quick example:

<input name="string" id="stringid">
<input type="button" id="buttonid">
<script type="text/javascript">
function checkit ()
{
var it = document.getElementById('stringid');
window.alert(it.value.length()==15 ? 'You win!' : 'You lose!');
}
document.getElementById('buttonid').onclick = checkit;
</script>

With server-side scripting, you'll need to find out which languages your
server supports. Many servers support PHP, so here's a PHP example:

<form action="<?=$_SERVER['PHP_SELF']?>" method="get">
<input name="string">
<input type="submit">
</form>
<?= (strlen($_GET['string'])==15 ? 'You win!' : 'You lose!'); ?>

> Secondly, I want the number that has been entered, to be added to a list
> on a hidden page.

This will certainly require server-side scripting. Client-side would not
be capable of this.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация