zoso729 Posted April 26, 2007 Share Posted April 26, 2007 Hello, Im trying to create a loop to display a set of asterisks to create a set of "stairs." example: * ** *** **** ***** ****** ******* Im not very good at html and everything Ive tried has failed. Does anyone have any suggestions or samples? Thanks a lot, i REALLY appreciate any help at all! Quote Link to comment Share on other sites More sharing options...
fenway Posted April 26, 2007 Share Posted April 26, 2007 No loops in HTML -- it's mark-up only. Quote Link to comment Share on other sites More sharing options...
john010117 Posted April 27, 2007 Share Posted April 27, 2007 Try PHP. Quote Link to comment Share on other sites More sharing options...
scdas Posted April 28, 2007 Share Posted April 28, 2007 You need something like this, embedded in your HTML: <? //starts PHP $asterisks="***************"; $no_of_stairs=10; for( i from 1 to $no_of_stairs) { echo substring($asterisks,$i); } ?> // ends PHP The above won't work, but it will get you started. I suggest you concentrate on the above as a PHP file: paste it into a text editor and save it as, say stairs.php in your cgi-bin folder. (I'm assuming you have a website capable of PHP.) Check out keywords (eg for, substring) in the PHP manual: http://www.php.net/manual/en/ to get the code working Cheers scdas Im trying to create a loop to display a set of asterisks to create a set of "stairs." example: * ** *** **** ***** ****** ******* Im not very good at html and everything Ive tried has failed. Does anyone have any suggestions or samples? Thanks a lot, i REALLY appreciate any help at all! Quote Link to comment Share on other sites More sharing options...
john010117 Posted May 2, 2007 Share Posted May 2, 2007 If trying that with PHP, make sure your server has PHP enabled. Quote Link to comment Share on other sites More sharing options...
twilightnights Posted May 2, 2007 Share Posted May 2, 2007 or you can do it with javascript client side, you don't need a server to do that Quote Link to comment Share on other sites More sharing options...
john010117 Posted May 3, 2007 Share Posted May 3, 2007 If you're gong with Javascript, I can't help you. I'm mainly a PHP freak. Quote Link to comment Share on other sites More sharing options...
TheFilmGod Posted May 16, 2007 Share Posted May 16, 2007 Why not make an image instead of these "stairs?" It wouldn't look professional the way you want to do it, if you did get it to work... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.