Note that there are some explanatory texts on larger screens.

plurals
  1. POsplitting url causing firefox to bug
    primarykey
    data
    text
    <p>I am trying ot implement the passing of variables with get between formulars and I basically use the <code>split()</code> method to recover the variable on each page. The problem that I have is that the script is stopped when I implement the splitting.</p> <p>It wasn't doing so earlier and now that I added the second function to check all the values of all the input names, I get this problem. I am new to javacsript so I don't really know where to look for and on top of this I really need to be able to get the variable's value. Here are the html of the first form and of the second one, with the <code>url.split("?");</code> causing firefox and my computer to get lost in the process...</p> <p>Here the first page:</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt; &lt;title&gt;&lt;/title&gt; &lt;link rel="stylesheet" type="text/css" href="style.css" /&gt; &lt;meta name="keywords" content="" /&gt; &lt;meta name="description" content="" /&gt; &lt;meta name="robots" content="index, follow" /&gt; &lt;meta name="googlebot" content="index, follow" /&gt; &lt;script type="text/javascript"&gt; &lt;!-- // --&gt; &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div&gt;Choose between&lt;br /&gt; &lt;form name="fo" method="get" action="part1.html"&gt; &lt;input type="radio" name="s1" value="1" /&gt;one&lt;br /&gt; &lt;input type="radio" name="s2" value="2" /&gt;two&lt;br /&gt; &lt;input type="radio" name="s3" value="3" /&gt;three&lt;br /&gt; &lt;input type="submit" value="continuer" /&gt; &lt;/form&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p><br> here the part1.html page, that contains the buggy script:</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt; &lt;head&gt; &lt;title&gt;&lt;/title&gt; &lt;script type="text/javascript"&gt; &lt;!-- function gValue(varname) { var url = window.location.href; var qparts = url.split("?"); if (qparts.length == 0) { return ""; } var query = qparts[1]; var vars = query.split("&amp;"); var value = ""; for (i=0;i&lt;vars.length;i++) { var parts = vars[i].split("="); if (parts[0] == varname) { value = parts[1]; break; } } return value; } function subnewsc() { for(i=1;i&lt;=3;i++) { var schck = "s" + i; var score = gValue(schck); score = parseInt(score); i = parseInt(i); var newscore = score+i; var doc = "document.fo.s" + i; doc.value=newscore; } } // --&gt; &lt;/script&gt; &lt;/head&gt; &lt;body onload="subnewsc();"&gt; &lt;div&gt;choose between&lt;br /&gt; &lt;form name="fo" method="get" action="part2.html"&gt; &lt;input type="radio" name="s1" value="1" /&gt;one again&lt;br /&gt; &lt;input type="radio" name="s2" value="2" /&gt;two again&lt;br /&gt; &lt;input type="radio" name="s3" value="3" /&gt;three again&lt;br /&gt; &lt;input type="submit" value="continuer" /&gt; &lt;/form&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload