AurianaValoria1 Posted May 1, 2013 Share Posted May 1, 2013 :mellow: Link to comment Share on other sites More sharing options...
M48A5 Posted May 1, 2013 Share Posted May 1, 2013 (edited) Werne,ย It works for me, :P must be something on your end :P Edited May 1, 2013 by M48A5 Link to comment Share on other sites More sharing options...
Werne Posted May 1, 2013 Share Posted May 1, 2013 :P It works for me too, it just craps up occasionally. :dry: Link to comment Share on other sites More sharing options...
AurianaValoria1 Posted May 1, 2013 Share Posted May 1, 2013 :mellow: Link to comment Share on other sites More sharing options...
Werne Posted May 1, 2013 Share Posted May 1, 2013 Link to comment Share on other sites More sharing options...
Ithildin Posted May 1, 2013 Share Posted May 1, 2013 :geek: Link to comment Share on other sites More sharing options...
Iv000 Posted May 1, 2013 Share Posted May 1, 2013 ย ย Does anyone here know much HTML/JavaScript? I've got a problem in this code that I just can't pinpoint!ย <html> <head> <script type="text/javascript"> function getSelection() { dropdownselect[0] = "Nothing"; dropdownselect[1] = "Maps"; dropdownselect[2] = "Weather"; dropdownselect[3] = "Beach Conditions"; dropdownselect[4] = "Traffic"; list = document.getElementById("select selection"); index = list.selectedIndex; theselection = list.options[index].text; document.getElementById("result").innerHTML = "You have chosen " + dropdownselect[index] } </script> </head> <body> <center> <select id="select selection" onchange="getSelection()"> <option selected="selected"> Nothing </option> <option> Maps </option> <option> Weather </option> <option> Beach Conditions </option> <option> Traffic </option> </select> <center> <p id="result"></p> </body> </html> These are the bits that aren't working. What I'm trying to do, is make it so that when I select one of the options in the dropdown menu, it displays the message "You have chosen " + dropdownselect[index] with the variables filled in. Problem is, it doesn't even show up at all. Can anyone help? Or should I start over?ย I don't know JavaScript but I get the basics, and it looks to me as if you're trying to call something that isn't there. You call dropdownselect[index] when the dropdownselect has no function other than standing there, the indexes aren't assigned to actual options. The "result" doesn't seem to contain any results either.ย Basically, I think you're trying to call an ID that isn't specified. Also, I believe the function for printing in JavaScript is document.write() :confused:ย Hmm, yeah I can see how that works. I'll have a go at fixing it tomorrow... so tired.ย The "result" is fine, you're letting the program know where to send the resulting text.ย I think your problem is that you just tacked on ย ย document.getElementById("result").innerHTML = "You have chosen " + dropdownselect[index] ย without giving it a proper beginning, a function.ย I searched a bit and the proper way to use this always began with a function.ย <html> <head> <script> function getValue() { var x=document.getElementById("myHeader"); alert(x.innerHTML); } </script> </head> <body> <h1 id="myHeader" onclick="getValue()">Click me!</h1> </body> </html> ย See the function at the beginning?ย document.getElement is usually used within a function afaik.ย Hope that helped:P I know a bit of HTML CSS and JS, but I'm at the beginning of JS. Link to comment Share on other sites More sharing options...
steampunk123 Posted May 1, 2013 Share Posted May 1, 2013 ... I bet i won't be the last XD Link to comment Share on other sites More sharing options...
Iv000 Posted May 1, 2013 Share Posted May 1, 2013 I love your avatar Link to comment Share on other sites More sharing options...
M48A5 Posted May 1, 2013 Share Posted May 1, 2013 :mellow: Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now