Forms That Allow To Calculate Question Answered Correctly
Dec 6, 2010
I'm trying to make a simple IQ test using javascript and forms that allows me to calculate the questions answered correctly and give the user a message box with the results. I had it working but now can't seem to get it to work anymore.
Here is my code:
<html>
<head>
<script language="JavaScript" type="text/javascript">
function calculate() {
var iq=0
var days = document.IQtest.Q1[3].checked
var time = document.IQtest.Q2[1].checked
var sleep = document.IQtest.Q3.value
var number = document.IQtest.Q4.value .....
Also, before when I had it working I couldn't get it to tell me that I had got the textbox questions correctly even when I had.
I'm trying to get a form submit working for all browsers, and I am using document.forms['formname'].submit(). However, despite having 'formname' set on the forms in both the name and id properties, Safari 3 will not submit the form correctly; when I debug, $_POST is empty. IE, FF both work here fine. If I use document.forms[0].submit() it works correctly, but this code will be working in a dynamic site where I can never be sure at what index a given form will reside. I can make it work using document.getElementById('formname').submit(), but that does not work with js turned off, and I need this to work with js on/off.
I have a form script that is made up of Text boxes, radio buttons, and drop down boxes. What I am wanting to happen is upon clicking submit at bottom of form, it should run a check to make sure all questions have been answered. So far it catches all the text boxes, but it's not catching the radio buttons or drop down boxes.. I have all of this under 1 form name ( is this where my problem is located? do I need to seperate into different form names based on type?) I am not wanting the answer given too me ( at least not yet ). I have done a search for multiple types of validation. But nothing seemed to clcik... Also Do I need another validation set up point for the Month, Date, year Drop down boxes?
I want to make few forms but 1 submit button. I want to do 1 page , 5 forms , 1 submit button so when i click on the submit button it will send the 5 forms as 1 form.
Where the inputs sum1 and sum2 are text fields you put whatever numbers you want in. That works fine. Great. Now what I'm having trouble with is modifying the code so that it will add one form with an input number with a form that spits out a randomly generated number.
This is what I'm using for my random number generator. So basically I want to be able to put, say, 5, into the input text field above this. And then click on the d20 button to get a random number, say, 15, and then have the first code add the inputted 5 with the randomly generated 15.
When you answer a question wrong or correctly, you will get feedback. Moving on to the next question, the feedback for the answered question will dissappear, just as it should be doing. However, when I move back to the question I have already answered, the "old" feedback is not there anymore. What shall I do to "store" feedback for each older questions that I have answered?
I am trying to test the id of three input boxes so that I can capitalize the first letter.
The fname and lname work fine but mi does nothing and I get no error is this because of the if statement or the fact that the mi only has one character?
first it gets string of the url in the address bar
then it splits the string at the ? and grabs the right half
it then makes an IFrame go to that string(which is yet another url I would manually insert)
here is the code:
function redirect(){ var raw=window.document.location.href; if(content_address_start=raw.indexOf("?")!=-1){
[Code]....
'content' is the id of the IFrame, and frame.html is the html file this code is inside.
Ok, so everything works perfectly when I test this code offline, but as soon as I load it to my website, and the .src line occurs, it just loads a blank page in the IFrame. What could be causing this? Perhaps certain sites will not allow themselves to be inside iframes? Much thanks in advance. I hope I gave enough information and relayed my problem clearly.
EDIT: It seems that the code works on other sites, just not youtube. Why would it do this and are there any ways around it?
I have a question here. I have 2 videos and if I click the image which uses #usemap, it will switch to the specific videos I clicked. FF and chrome has no problem but only IE.
The scenario is like this: Actual scenario is when the page load, it will display tab 1, video 1 and tab 2 is greyed out. If I clicked on tab 2, tab 1 is greyed out and video 2 is display. Both tabs I use #usemap.
But now the problem in IE is that it keeps on displaying tab 1 and video 2 instead of video 1 and when I clicked tab 2, tab 2 is selected but no video is loaded. Below is a simple code which hope it can helps better understanding of what I'm trying to do:
IE just keep displaying video 2 when page load and video doesn't loads when tab 2 is clicked. Even if I program the 2 divs to be show, it only shows video 2 and video 1 is nowhere to be seen. And I tried taking out the video 2 codes, video 1 then can be seen.
I'm using the niceforms plugin to style my select box. The problem I'm having is that I can't get the right javascript code to activate the links placed in the value option.
el.lnk._onclick = el.onclick || function () { if(this.ref.oldClassName == "NFOnChange") { //insert your code here }};
This is my attempt at manipulating the code to allow url linking in the select drop down
el.lnk._onclick = el.onclick || function () { if(this.ref.oldClassName == "NFOnChange") { //code i added window.location.href = $(this.ref).val(); }};
The PROBLEM is the links do not work as expected, they do not link to their corresponding values.
form class ="niceform" select class ="NFOnchange" option value = "http://link1.com" -> link1.com option value = "http://link2.com" -> link2.com option value = "http://link3.com" -> link3.com
i just need to insert the right bit of code to make the links correspond to their option values.
Been trying to work through a simple drag and drop interface using either IMG, SPAN or DIV tags. That way I can define blocks of text and/or graphics as draggable and be able to drop them on a similar (img, div, span, etc.) target, preferably an image.
I can highlight text from an "<input type=text>" field and reach a target to trigger an event (e.g. alert();), but can't get the same response when the dragged item is a block of text or an graphic and drop it on either of the same targets. Code:
I am opening a new window using window.open. I need the new window to open on top of the parent everytime. I cannot use onBlur b/c the user will need to click back to the parent for information. I just need it to open on top everytime. I am using this line in the body <body onload="window.focus()" bgColor="#0077d6" ms_positioning="GridLayout">
The window.focus doesn't work everytime. I can open it and it may work. I will completely close the app, start it again and it will not work, but the next time it might. It is inconsistent. How do I get it to not give focus back to the parent after it opens? How can I get the parent to relinquish focus?
I got a pice of html that i want to transform to UI Tabs. This code is aouto generated and wrong, so I want to correct it before calling tabs() function
I am using the "jQuery UI Multiselect" from [URL] I need to have it inside a <div> set with "display: none;" from the start. The user then clicks a link and the <div> tag opens op.
The problem is that whenever I open the box the Multiselect does not show up correctly, it shows up as a 3pixel wide stick. You can see an example at: [URL]
Using 1.8.16 I have a problem whereby the secondary, hidden tabs do not display correctly - the content is all messed up. if I click on one of the messed-up tabs and reload the browser window, it displays ok, which signifies that the code responsible for building the tab content is fine... so the problem is with .tabs()
I've got this page with some simple numerical validation : [URL].. but when the number you enter into the input fields are 100 or over the validation fails.
I have some JavaScript that calls an AJAX function that in turn refreshes a DIV. I have a working model of this for a comment box. When a user types in a comment and hits send, the data is sent to a server and only the div refreshes; not the entire page
I need to add one more level of functionality to this working model. But when I change it a bit to fit what I need it does not work!
Each comment is related to a specific mediaID, and when comments are listed they all have the same mediaID. The mediaID is changed by clicking on a flash video link which in turn calls a method that "should" refresh the comments box with the correct comments. The problem is the DIV does not refresh with the php page that I provide it; instead, it puts the home page in the DIV. In my working model the DIV refreshes with the php page that I provide it.
I'm using the Google Maps API (v 2) to display my phones last known location on a map. On this 'bare bones' page, the Google Maps tiles load correctly, without any jerking:
[URL]
However, on my customised page, the tiles jerk and slide around (try dragging the map and zooming out). This is particularly evident on Safari and Chrome.
[URL]
I'm not entirely sure how to fix it. The Web Developer script analyser is not returning any errors and I'm really at a loss to understand where I'm going wrong!
if it displays -Infinity or Infinity, it wont say "Invalid entry" and it wont keep going past -Infinity or Infinity. and if it says NaN it doesnt go past NaN and say "Invalid entry"
function checkNum(str) { for (var i = 0; i < str.length; i++) { var ch = str.substring(i, i+1) if (ch < "0" || ch > "9") {
i have a function that deletes a DOM table and then recreates it based on the values that input by the user. i have a page that has two text's on it and 3 select combos on it. when i reload the page, enter the values for the first time, the table populates correctly. if i simply change the values and not reload the page, and then click my "calc" button again, the table populates correctly EXCEPT for the "payment period" select combo box value, if it is indeed has been changed. here is the portion of my code that populates the table rows:
var i = 1 if (document.getElementById("paymentperiod").value == "Monthly") { var Period = 12; var PeriodStr = "m";
I'm looking for some guidance on a part of some coding practice I'm stuck on!
I've created a shopping cart using javascript, the items save to the arrays etc and it all works fine. If the user adds the same product again to the cart the quantity is added onto the previous quantity that is already in the cart.
To check if the item is already in the cart I've ued the below code, but what it does is update the quantity for the first cart, and when it updates the quantity for the second item it updates the quantity but keeps adding the same product to the cart in seperate elements of the array as well (if that makes sense?
here are the two functions used [code]...
It may jsut be a simple mistake I've made but it's been bugging me a lot and I can't seem to fix it.