Month's top: Carnack with 100$
Want LAH to translate a manga for you?
Little Angels Hentai Forum Index
It's for you!
Little Javascript/HTML help

 
Compose reply Little Angels Hentai Forum Index » Help and test-post forum View previous thread
View next thread
DMCA
Little Javascript/HTML help
Author Message
feather
DaVinci Angel
Warnings: Warning
Posts: 22

Post Little Javascript/HTML help Quote
If you've been to Project "A", (hxxp://www.freewebs.com/feather-chan/Micros.html) (yeah, I know none of you have) you've seen I use javascript and some HTML buttons to turn the pages. This is essentially a system built by my comic program, though I adapted it.

Anyway, I'd like to add a drag-down menu, so you can jump right to a specific page. It seems to me like it should be simple, but without actually knowing Javascript I haven't been able to MacGuyver it into working. I'd like it not to have an ugly "Go" button.

Anyway, it would be appreciated if someone could code this for me. *bows*


Code follows (duh):

Code:
<script type="text/javascript" language="javascript">

var numPages = 3;
var curPage = 0;      <!-- The Page currently being displayed-->
var pages = new Array(numPages);
pages[0] = "img/Micros/Page_1.jpg";
pages[1] = "img/Micros/Page_2.jpg";
pages[2] = "img/Micros/Page_3.jpg";
pages[3] = "img/Micros/Page_4.jpg";
pages[4] = "img/Micros/Page_5.jpg";
pages[5] = "img/Micros/Page_6.jpg";
pages[6] = "img/Micros/Page_7.jpg";
pages[7] = "img/Micros/Page_8.jpg";
pages[8] = "img/Micros/Page_9.jpg";
pages[9] = "img/Micros/Page_10.jpg";
pages[10] = "img/Micros/Page_11.jpg";
pages[11] = "img/Micros/Page_12.jpg";
pages[12] = "img/Micros/Page_13.jpg";
pages[13] = "img/Micros/Page_14.jpg";
pages[14] = "img/Micros/Page_15.jpg";
pages[15] = "img/Micros/Page_16.jpg";


    function updateButtons() {
        var nextButton = document.getElementById("nextButton");
        var prevButton = document.getElementById("prevButton");
        var firstButton = document.getElementById("firstButton");
        var lastButton = document.getElementById("lastButton");
        nextButton.disabled = curPage == numPages - 1;
        prevButton.disabled = curPage == 0;
        firstButton.disabled = curPage == 0;
        lastButton.disabled = curPage == numPages - 1;
    }
   

    function nextPage() {
        if (curPage < numPages - 1) {
            curPage = curPage +1;
            var image = document.getElementById("pageImage");
            image.src = pages[curPage];
        }
        updateButtons();
    }
   
    function prevPage() {
        if (curPage > 0) {
            curPage = curPage - 1;
            var image = document.getElementById("pageImage");
            image.src = pages[curPage];
        }
        updateButtons();
    }
   
    function firstPage() {
        if (curPage > 0) {
            curPage = 0;
            var image = document.getElementById("pageImage");
            image.src = pages[curPage];
        }
        updateButtons();
    }
   
    function lastPage() {
        if (curPage < numPages - 1) {
            curPage = numPages - 1;
            var image = document.getElementById("pageImage");
            image.src = pages[curPage];
        }
        updateButtons();
    }
   
</script>


_________________
This space intentionally left blank.
Sat Sep 22, 2007 3:27 am Profile PM
Azrael
Archangel of Death
Warnings:
Posts: 2

Post Quote


_________________


the secret method to get passwords to files, and access to the elite extra files board is revealed here
Sat Sep 22, 2007 4:10 am Profile PM
feather
DaVinci Angel
Warnings: Warning
Posts: 22

Post Quote
It's not supposed to link to a new webpage, it runs a function that changes the image on the page. I think the function looks like this
Code:
    function menu(Num) {
        curPage = Num;
        var image = document.getElementById("pageImage");
        image.src = pages[curPage];
        updateButtons();
    }

EDIT: I've just tested it, and it does work perfectly.


_________________
This space intentionally left blank.


Last edited by feather on Sat Sep 22, 2007 4:58 am; edited 2 times in total
Sat Sep 22, 2007 4:34 am Profile PM
Azrael
Archangel of Death
Warnings:
Posts: 2

Post Quote
hmm..

so rather then move to a new page, it moves to a new picture on the same page? possibly i might have a friend that could make it work with the code i mentioned, because i'm not quite that great at javascript, i'm pretty good with html.. but my JS is lacking lol


_________________


the secret method to get passwords to files, and access to the elite extra files board is revealed here
Sat Sep 22, 2007 4:42 am Profile PM
feather
DaVinci Angel
Warnings: Warning
Posts: 22

Post Quote
Well, I think all I need is a menu that calls a function, sending it a variable. The variable should be the value of the option. >.> that's in the HTML, isn't it?


_________________
This space intentionally left blank.
Sat Sep 22, 2007 4:46 am Profile PM
feather
DaVinci Angel
Warnings: Warning
Posts: 22

Post Quote
Totally bumped. In my mind, this should work, but it doesn't.

Code:
<form>
  <select name="menu" onChange="menu(value)">

    <option value="0">1</option>
    <option value="1">2</option>
    <option value="2">3</option>
    <option value="3">4</option>
  </select>
</form>

Wait, should I be using parentheses there or one of the other bracket sets?


_________________
This space intentionally left blank.
Mon Sep 24, 2007 3:48 am Profile PM
Display posts from previous:    
Options Quick Reply
Show Smilies

 
Compose reply Quick reply Little Angels Hentai Forum Index » Help and test-post forum All times are GMT
Page 1 of 1

 
Jump to: 
You can post new threads in this forum
You can reply to threads in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


Do not upload or mention any illegal content. Violators will be reported to the authorities. You are responsible for your uploads and actions.
If it is illegal for you to view adult lolikon material in your current location, leave this site immediately.
LAH is in compliance with DMCA.
LAH works best with JavaScript enabled. Enable it for a better experience. (´・ω・`)
Your browser is outdated and insecure! Please update your browser to fully enjoy LAH.