473,800 Members | 2,726 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem making query string in URL work (trivia game)

I am stumped. I encoded the action = of my form using GET and I can't seem
to get the property/value stuff from it using a JavaScript script I got from
the web.

I want to create a trivia game where the user gets 1 question at a time and
it keeps scoring until the end and gives a summary and I want to do it only
in JavaScript (no ASP, PHP, JSP, etc).

I tried submitting the quiz page to itself using a query string to keep
track of question # but no joy.

I can post code if necessary or is there a trivia game engine made for 1
question at a time instead of all on 1 page?
Anyway, I looked on Google at the query string issue til I'm sick of it. I
found a Beatles trivia game but it was using frames and hidden JavaScript
source files and that's too much work to try and figure out all of that.
Any help is appreciated.
Thanks,
Tim
Jul 23 '05 #1
2 2221
I think There is a 1024byte limit on the length of an URL. It might be
that there is too much data to be send. That could be the problem. Else
I have a script that can read the parameters of an URL:

function getParameter(p) {
p +="=";
s = document.locati on.href;
s = s.substring(s.i ndexOf("?")+1);
while (s.length>p.len gth) {
if (s.substring(0, p.length)==p) {
end = s.indexOf("&");
if (end<0) end = s.length;
return unescape(s.subs tring(p.length, end));
}
if (s.indexOf("&") >0) {
s = s.substring(s.i ndexOf("&")+1);
} else s="";
}
return null;
}

Else you might want to try using cookies or something, or use the hidden
frame technique.

Vincent
Tim Simmons wrote:
I am stumped. I encoded the action = of my form using GET and I can't seem
to get the property/value stuff from it using a JavaScript script I got from
the web.

I want to create a trivia game where the user gets 1 question at a time and
it keeps scoring until the end and gives a summary and I want to do it only
in JavaScript (no ASP, PHP, JSP, etc).

I tried submitting the quiz page to itself using a query string to keep
track of question # but no joy.

I can post code if necessary or is there a trivia game engine made for 1
question at a time instead of all on 1 page?
Anyway, I looked on Google at the query string issue til I'm sick of it. I
found a Beatles trivia game but it was using frames and hidden JavaScript
source files and that's too much work to try and figure out all of that.
Any help is appreciated.
Thanks,
Tim


Jul 23 '05 #2
Hello,

Vincent, I am sending only a few bytes (less than 10) and using cookies is
not a good idea since many have them turned off and I refuse to use frames.

When using a query string, do I have to test it on a web server or will it
work locally w/o a server such as IIS? I know server-side script needs a
server but I have no server-side script in the page. It's all client-side.

When I get the string from the URL it says it is undefined.

Okay, I have posted the two pages here:
http://www.timsimmons.com/origins.htm

The first page sends a number to 2nd page using query string. View the
source to see what I did.

Any help is appreciated. A better way of coding it is also appreciated!
Tim
"Vincent van Beveren" <vi*****@provid ent.nl> wrote in message
news:40******** *************@n ews.xs4all.nl.. .
I think There is a 1024byte limit on the length of an URL. It might be
that there is too much data to be send. That could be the problem. Else
I have a script that can read the parameters of an URL:

function getParameter(p) {
p +="=";
s = document.locati on.href;
s = s.substring(s.i ndexOf("?")+1);
while (s.length>p.len gth) {
if (s.substring(0, p.length)==p) {
end = s.indexOf("&");
if (end<0) end = s.length;
return unescape(s.subs tring(p.length, end));
}
if (s.indexOf("&") >0) {
s = s.substring(s.i ndexOf("&")+1);
} else s="";
}
return null;
}

Else you might want to try using cookies or something, or use the hidden
frame technique.

Vincent
Tim Simmons wrote:
I am stumped. I encoded the action = of my form using GET and I can't seem to get the property/value stuff from it using a JavaScript script I got from the web.

I want to create a trivia game where the user gets 1 question at a time and it keeps scoring until the end and gives a summary and I want to do it only in JavaScript (no ASP, PHP, JSP, etc).

I tried submitting the quiz page to itself using a query string to keep
track of question # but no joy.

I can post code if necessary or is there a trivia game engine made for 1
question at a time instead of all on 1 page?
Anyway, I looked on Google at the query string issue til I'm sick of it. I found a Beatles trivia game but it was using frames and hidden JavaScript source files and that's too much work to try and figure out all of that.
Any help is appreciated.
Thanks,
Tim

Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
4456
by: BlackHawke | last post by:
My name is Nick Soutter, I own a small game development company (www.aepoxgames.net) making our first game (www.andromedaonline.net) in java. I am writing because we are having a very serious problem, and I was hoping someone might have thoughts.
1
2255
by: banjo123 | last post by:
Dear java.help: I just started learning java and was trying to compile some java sourc from the Javascript World Submission webpage. I know I have loaded m JDK successfully since I can compile other examples but when I try t compile the following code, I get several errors. I typed "javac J1.java(source file name)" Any feedback is appreciated.
3
2599
by: Roman | last post by:
I've been trying this one for 2-3 hours and can't figure it out. I'de appreciate any help or pointers in the right direction. Thanks. Query I need the query to return me all the lottery names and results that have the latest date in the database for that particular game and for the state . So the return data from the data below data would be: Result: --------------------------
4
1783
by: Jeremy | last post by:
I have an include file which has some text such as: The quick brown fox jumped over the lazy dog I want to have a certain amount of that text to display on one page wherein the user can click a link for more of the text on a new page such as: The quick brown fox >>MORE
6
2249
by: jcrouse | last post by:
Here is a sniplet from a text file game name mapp description "Mappy (US) year 198 manufacturer "Namco history "\nMappy (c) 03/1983 Namco. \n\n- TRIVIA: \n\nLicensed to Bally Midway for US manufacture and distribution. (03/1983) \n\n- SERIES: \n\n1. Mappy \n2. Hopping Mappy \n\n0.26 \n\nBugs: \n- \"000\" is displayed on the highscore. If you get more than 30000 pts, it is displayed normally. This happens whether there are...
3
1288
by: jcouse | last post by:
I am trying to find if a string exists in a file. If it doesn’t, it should return a “-1” and I’ll make my decision based on that Here is a sniplet of the text file game name mapp description "Mappy (US) year 198 manufacturer "Namco history "\nMappy (c) 03/1983 Namco. \n\n- TRIVIA: \n\nLicensed to Bally Midway for US manufacture and distribution. (03/1983) \n\n- SERIES: \n\n1. Mappy \n2. Hopping Mappy \n\n0.26 \n\nBugs: \n-...
27
5156
by: comp.lang.tcl | last post by:
My TCL proc, XML_GET_ALL_ELEMENT_ATTRS, is supposed to convert an XML file into a TCL list as follows: attr1 {val1} attr2 {val2} ... attrN {valN} This is the TCL code that does this: set contents ]; close $fileID
3
5324
by: Gerrit | last post by:
Hi, I try to learn programming in c# with databinding controls. Now I have a problem with a ComboBox with the advanced properties for databinding, I want to set the DataSourceUpdateMode to OnPropertyChanged, but then the combobox does not display the right displaymember. Below is my sample code (it is working, when you paste it in a new windowsapplication, in a form and delete some generated code, but it is not a useful program but...
5
4586
by: alesitaam | last post by:
Help!!!! Im new using python, currently writing a program which tests one game, IQ test. When the module is run, the program should ask user to choose the game to start. Also, I'm using Try...Except statements, and os file operator. My code needs some adjustments, most of all at the end. Please give some tips!!! import os while True: print"Welcome to trivia game!" print "0-Choose a game to play:" print "1- IQ Test.trv"
0
9691
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
10507
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10279
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10036
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9092
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7582
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5473
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5607
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2948
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.