Write a JavaScript function method, parsequerystring, to parse the URL parameter into an object
varUrl= "http://www.taobao.com/index.php?key0=0&key1=1&key2=2";functionparsequerystring () {varStr=url.split ("?") [1]; varItems=str.split ("&"); varresult={}; varArr= ""; for(vari=0;i<items.length;i++) {arr=items.split ("="); result[arr[0]]=arr[1]; } returnresult;} varobj=parsequerystring (URL); console.log (obj);
Complete the contents of the Foo () function, ask to be able to pop up a dialog box to prompt the currently selected things first few radio boxes
<HTML><Body><Script> functionfoo () {varRadios=Document.getelementsbyname ("Radiogroup"); for(varI=0; I<Radios.length;i++){ if(radios[i].checked== true) { varN=I+ 1; Alert ("Section" +N+ "a single box is clicked"); }}</Script> <formname= "Form1"onsubmit= "return foo ();"> <inputtype= "Radio"name= "Radiogroup"> <inputtype= "Radio"name= "Radiogroup"> <inputtype= "Radio"name= "Radiogroup"> <inputtype= "Radio"name= "Radiogroup"> <inputtype= "Submit"> </Body></HTML>
Some of the features that are implemented by the method of writing JavaScript.