codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Help with Form--onClick won`t run function  bigdave515 at 19:39 on Saturday, May 02, 2009
 

I have a very basic character quiz that I've made based on other ones I've seen and used the same scripting. They all have a function in the head that is called upon in the form to display the proper result page. My "button" that should run the program doesn't seem to do anything. Please help. Source code is below:
----------------------------------------------------------------------------
----------------------------------------------------------------------------

<b>Inside the head.......</b>

for (i = 0; i < f.nine.length; i++) if (f.nine.checked) value = f.nine.value;
if (value == "1") { gamb++; cyclo++; ice++; angel++; jugg++; forge++;}
if (value == "2") { profx++; wolv++; saber++; colos++; night++;}
if (value == "3") { apoc++; beast++; magn++; sinis++; profx; wolv++; saber++; colos++; night++;}

for (i = 0; i < f.ten.length; i++) if (f.ten.checked) value = f.ten.value;
if (value == "1") { profx++; cyclo++; ice++; angel++; beast++; magn++; night++; forge++; sinis++; }
if (value == "2") { wolv++; saber++; apoc++; gamb++: colos++; jugg++; }

for (i = 0; i < f.eleven.length; i++) if (f.eleven.checked) value = f.eleven.value;
if (value == "1") { profx++; apoc++; cyclo++; ice++; angel++; beast++; magn++: night++; forge++;}
if (value == "2") { wolv++; saber++; gamb++; colos++; jugg++; sinis++; }

var out = "profx";
i = profx;
if (profx > i) { out = "profx"; i = profx; }
if (wolv > i) { out = "wolv"; i = wolv; }
if (saber > i) { out = "saber"; i = saber; }
if (apoc > i) { out = "apoc"; i = apoc; }
if (gamb > i) { out = "gamb"; i = gamb; }
if (cyclo > i) { out = "cyclo"; i = cyclo; }
if (ice > i) { out = "ice"; i = ice; }
if (beast > i) { out = "beast"; i = beast; }
if (colos > i) { out = "colos"; i = colos; }
if (magn > i) { out = "magn"; i = magn; }
if (jugg > i) { out = "jugg"; i = jugg; }
if (night > i) { out = "night"; i = night; }
if (forge > i) { out = "forge"; i = forge; }
if (angel > i) { out = "angel"; i = angel; }
if (sinis > i) { out = "sinis"; i = sinis; }
location.href = out + ".html";
}
function err(msg, url, line)
{
location.href = "error.html";
}
//window.onerror = err;
// -->
</SCRIPT>

<b>
Inside the form I have a number of questions such as......
</b>

11. Are you more clean/organized or messy?
<input type="radio" name="eleven" value="1">
Clean<br />
<input type="radio" name="eleven" value="2">
Messy<br />

Before the form ends I have....
<INPUT type="button" value="Who Am I?" onClick="process();">
----------------------------------------------------------------------------
----------------------------------------------------------------------------
I've seen multiple sites have this same layout and their buttons work perfectly in any browser. I know javascript is enabled, but don't know why this isn't working. The page is in html, not asp if that matters. I appreciate your time.


  Re: Help with Form--onClick won`t run function  S_Flex at 11:28 on Monday, May 04, 2009
 

Your html is a mix of xhtml and html, pick 1.

I see no function called "process" and onClick should all be lower case (ie. "onclick") and I'm assuming the form you are using has the beginning and ending form tag.

Also saying that it works in other browsers doesn't tell us what browser or version of browser it was.










CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  `section` is an unexpected token. Expecting white space. Line 1, position 137.
•  Javascript rollover toggle help please!
•  help monitoting cpu load on windows machine
•  Re: convert aspx page to pdf
•  Accessing .htc file
•  Access binary data from http
•  Inserting checkbox values into one field
•  Silverlight or ASPX ?
•  Export to excel


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2009