javascript - OnClick function is not working in IE 10, but fine in older versions -
javascript - OnClick function is not working in IE 10, but fine in older versions -
within standard dot.net application there alternative add together buttons, can functions.
this button, when clicked, opens google in new window input parameter current window.
<button class="exbutton" language="vbs" onclick="makereq()">search google</button> <script language="vbs"> sub makereq() window.open "https://www.google.nl/?gws_rd=ssl#q=" & frmmain.freetextfield_01.value end sub </script>
the button works fine in ie9 or in ie10 in compatibility mode. on chrome or ie 10 not function. no response or visible error.
does know:
why fails function in ie10? more importantly how can adjust code working again?please maintain in mind can influence little piece of script rest of page controlled supplier of application.
move javascript, this:
<button class="exbutton" onclick="makereq()">search google</button> <script language="text/javascript"> function makereq() { frmmain = document.forms[0]; // if first form textfield = frmmain.elements["freetextfield_01"]; window.open("https://www.google.nl/?gws_rd=ssl#q="+textfield.value; } </script>
but it's not cleat frmmain.freetextfield_01.value, tried imagine field in first form in page.
other ways be:
textfield = document.getelementsbyname("freetextfield_01")[0];
or
frmmain = document.forms["frmmain"]; textfield = frmmain.elements["freetextfield_01"];
or
frmmain = document.forms[0]; // if first form textfield = frmmain.elements[0]; // if first form element
or
frmmain = document.getelementbyid("frmmain"); textfield = frmmain.elements["freetextfield_01"];
if form has id="frmmain"
javascript jquery asp.net
Comments
Post a Comment