Charas-Project

Off-Topic => All of all! => Topic started by: X_marks_the_ed on April 25, 2008, 11:57:41 PM

Title: HTMLOLMAO STFU
Post by: X_marks_the_ed on April 25, 2008, 11:57:41 PM
I'd post in the HTML forum, but no one goes there anymore.

I'm trying to code an image that when clicked, will change another image to the next one. Basically, a "click me to go to the next page" kinda thing. But not just going to another web page, but instead going to the next image. I think it may be possible through variables, but I'm not that advanced.

If It helps, you can see the page at  (http://www.freewebs.com/lihcomic). Just go to pages -> story arcs.
Title:
Post by: Osmose on April 26, 2008, 03:00:18 AM
So you want an image that changes as you click a link?

So, given your images are set up like so:

comic1.png, comic2.png, comic3.png, and so on

Try this (Replace pipe characters | with < and > for tags. I'd make the code tag actually work to display them properly but the forum is being evil and I have to go now. Sorry.

The image itself:

|img src="comic1.png" id="comic" /|

Within the head tags for the page, where normal Javascript goes:

|script type="text/javascript"|
var imgNum = 0;
|/script|

The link:

|a href="#" onclick="comicNum++; document.getElementById('comic').src = 'comic' + comicNum + '.png'; return false;"|Click Me!|/a|

I'm too lazy to test it but it should work. If you have problems with it I'll try to test it out myself.
Title:
Post by: X_marks_the_ed on April 26, 2008, 01:24:21 PM
It works, but only because I noticed you must've accidentally typed comicNum instead of imgNum for the rest of the code. o.O

In addition, if I wished to put in story arc shortcuts, how would I go about doing that?
Title:
Post by: X_marks_the_ed on April 26, 2008, 02:01:28 PM
Right. Waiting for flash to load 200 pages of a webcomic. :D

Bah, rather use HTML. Just don't have everything load at once, only let pages that the visitor wants to read load. :/

EDIT: Nevermind about the story arc shortcuts. Playing around with it, I figured it out. :D
Title:
Post by: Osmose on April 26, 2008, 05:12:29 PM
Flash is for a specific purpose - movies or games. Using Flash for anything besides that is tawdry in frowned upon. Almost everything that may be "easy" to do in flash is just as easy to do in JS/CSS and will be better done in it anyway.

I use NoScript and one of the most frustrating things to me is having to add an exception for a site that uses flash for a menu or for functionality.

So no, you fail. Let us web designers figure out how to build websites. :P