I have a series of checkboxes on the HTML page and I want to see the checkbox based on this HTML query string parameter.
For example
... path / page.html? I = 1 & amp; J = 1 & amp; X = 0
will
Can anyone show me how to do this or direct me in the direction of a suitable tutorial?
Many thanks,
Edit: An explanation, I, j and x have just been raised above my head, but they are Boolean variables (1 = true, 0 = false) And corresponds to each checkbox so that:
i = A checkbox, the value in the value is 1, so the checkbox must be checked. A = checkbox above = J = X, the value in the value is 0, so the checkbox should not be checked. Partially this file will crawl a single checkbox and ?
URL & lt ;! DOCTYPE HTML Public "- // W3C // DTD XHTML 1.0 Transcription / / N" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> & Lt; Html xmlns = "http://www.w3.org/1999/xhtml" & gt; & Lt; Top & gt; & Lt; Meta http-equiv = "content-type" content = "text / html; charset = UTF-8" /> & Lt; Title & gt; Untitled document & lt; / Title & gt; & Lt; / Head & gt; & Lt; Script type = "text / javascript" & gt; Function getUrlVars () {var vars = [], hash; Var hashes = window.location.href.slice (window.location.href.indexOf ('?') + 1) .split ('& amp;'); For (var i = 0; i & lt; hashes.length; i ++) {hash = hash [i] .split ('='); Vars.push (hash [0]); Wars [hash [0]] = hash [1]; } Returns Wars; } Function doStuff () {var GETVars = getUrlVars (); If (GETVars ['j'] == 1) {document.getElementById ("myCheck") Check = true; }} & Lt; / Script & gt; & Lt; Body onload = "doStuff ();" & Gt; & Lt; Form & gt; & Lt; Input id = 'myCheck' type = "checkbox" /> & Lt; / Form & gt; & Lt; / Body & gt; & Lt; / Html & gt;
Comments
Post a Comment