Click to See Complete Forum and Search --> : JavaScript
SiriusBlack423
04-23-2003, 01:19 PM
If there are any HTML Geniuses out there, please take a minute of your time to read this. I work for a web-site, MuggleNet.com. I run a page called the Caption Contest, which is a sort of contest where I post a picture and they send in their ideas as to what the people should be saying. Anyway, the increasing hits on the site (yesterday 520,000 in mid-evening) has led my winning caption number to raise, and raise.
To prevent the list of winners from being too long, and still not cut anybody off, I was wondering if there would be a way to create an interactive box. In the box would show a winning caption, that would allow the visitor to go to "next" or "back" in such a way to view the next or previous caption winner. Customizable background and text color would be appreciated, though not necessary.
If you do have any knowledge of a script I could use, please e-mail me at SiriusBlack423@aol.com or post on this forum if emailing is unavailable. Thank you!
-Eric
khalidali63
04-23-2003, 02:34 PM
I think your question is hard to understand that what exactly you are trying to do,may be better if you can point to your page and then relate the items in your question to the objects on the page for better understanding of your problem..:D
SiriusBlack423
04-23-2003, 02:45 PM
People always say I don't make sense... =)
http://www.mugglenet.com/captioncontest.shtml
That is the link to my page. Below the "last week's picture" and the picture that I had the people do captions for, there's the list of the winning ones. Instead of having a list of them, though, I'd like to know how to create a box the size of only one of the captions, and allow the visitor to click something like "next" and the next caption on the list will then show up in the box instead...
If that's possible or atleast if you understand me please let me know! Thanks!
-Eric
khalidali63
04-23-2003, 02:52 PM
oh okkkay..instead having all those winning entries appear like that you'd rather have a mechanism that will only display one entry at any given time,and then on click you can browser through next or previous entry???
SiriusBlack423
04-23-2003, 02:53 PM
Exactly!!! Do you know how to do it? =O
khalidali63
04-23-2003, 02:56 PM
wel first you have to let me know that how are you storing the user input and then how are you retireving it,because you want to create an array of all winner entries at the point when the page loads and then from that array just print first or last or any random entry..
SiriusBlack423
04-23-2003, 06:17 PM
I'm sorry to post with no progress, though I'm not quite sure I understand you... Could you perhaps re-word the question? Oh.. sorry for my disappearance, too. Today's my birthday and I went out to dinner for it, tried to get home as soon as I could, though apparently when you order "medium" burgers they give you "pretty-darn-well-done" as a birthday joke... :(
DrDaMour
04-23-2003, 08:31 PM
what he's asking is are you inputing all these winning quotes by hand or are they coming from some database? I'm assuming you're butting them in by hand. So what i would do would be the following
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<script>
index = 0;
var qs = new Array();
qs.push('Hello you punk');
qs.push('Punk You');
qs.push('go away');
function quotes(way){
index += way;
if (index < 0) index = index + qs.length;
index = index % qs.length;
document.getElementById("quotes").innerHTML = qs[index];
}
//this is for when it first loads
</script>
</HEAD>
<BODY>
<div id="quotes"></div>
<input type=button value="Previous" onclick="quotes(-1)"><input type=button value="Next" onclick="quotes(1)">
<script>
//this starts it with the first quote
document.getElementById("quotes").innerHTML = qs[index];
</script>
</BODY>
</HTML>
you would just keep doing qs.push('quote') for all the quotes, if you want to use html tags in that it's fine too, bascially whatever is in there gets sent to taht div tag and interpreted
if you are using some type of database, then it can auto fill that array using a loop, but on server side
SiriusBlack423
04-24-2003, 01:32 PM
Yes, I was putting them in by hand. I'm not at home right now, but wanted to say thanks for the code, and I'll try it as soon as I can! :)
SiriusBlack423
04-24-2003, 07:26 PM
Hey, thanks alot! It will look great! Is there any way, however, that I could make the text appear below the buttons? Due to the varying lengths of the winners, the buttons will move quite frequently otherwise.
SiriusBlack423
04-24-2003, 07:32 PM
Also, the multiple-lined entries seem to be causing an error... Is there any way to fix that? :confused: