straygrey Posted October 30, 2012 Share Posted October 30, 2012 Please tell me why the following html does not call the javascript submit_click() function. <!DOCTYPE html> <html> <head> <title>Page Title</title> <meta name="[url=""]viewport[/url]" content="[url=""]width=device-width,initial-scale=1[/url]"> <link rel="[url=""]stylesheet[/url]" type="[url=""]text/css[/url]" href="[url="view-source:http://localhost/prince/style/style.css"]style/style.css[/url]"/> <script language="[url=""]Javascript[/url]" type="[url=""]text/javascript[/url]" src="[url="view-source:http://localhost/prince/js/Diva.js"]js/Diva.js[/url]"></script> <style type="[url=""]text/css[/url]">a {text-decoration: none}</style> <script language=[url=""]javascript[/url]> function submit_click() { alert("Button Pressed"); progExe("logon.php?"uname="+uname+"&Passwrd="+passwrd); } </script> </head> <body> <!--- <form name="logon" ID="logon" action="logon.php" method="post"> --> <table align="[url=""]center[/url]" border="[url=""]3[/url]" cellspacing="[url=""]0[/url]" cellpadding="[url=""]3[/url]"> <tr><td>Username:</td><td> <input type="[url=""]text[/url]" name="[url=""]uname[/url]" id=[url=""]uname[/url] maxlength="[url=""]40[/url]" placeholder="[url=""]Enter your UserName[/url]" autofocus required> </td></tr> <tr><td>Password:</td> <td> <input type="[url=""]password[/url]" name="[url=""]passwrd[/url]" id=[url=""]passwrd[/url] maxlength="[url=""]50[/url]" placeholder="[url=""]Password[/url]" required> </td></tr> <tr><td colspan="[url=""]3[/url]" align="[url=""]center[/url]"> <button type="[url=""]button[/url]" onclick="[url=""]submit_click()[/url]">Logon</button> <a href="[url="view-source:http://localhost/prince/register.html"]register.html[/url]"><input type=[url=""]submit[/url] value="[url=""]RegisterSelf[/url]"> <a href="[url="view-source:http://localhost/prince/client.html"]client.html[/url]"><input type=[url=""]submit[/url] value="[url=""]RegisterClient[/url]"> </td></tr> </table> <center> <div id="[url=""]loadingNode[/url]";></div> </center> </body> </html> Link to comment https://forums.phpfreaks.com/topic/270064-html5-javascript-not-working-together/ Share on other sites More sharing options...
OOP Posted October 30, 2012 Share Posted October 30, 2012 Hi there, I beleive the "language" attribute in script tag is obsolete in HTML5, remove it and that should solve your issue. Link to comment https://forums.phpfreaks.com/topic/270064-html5-javascript-not-working-together/#findComment-1388648 Share on other sites More sharing options...
haku Posted October 31, 2012 Share Posted October 31, 2012 That's correct. It was actually deprecated in HTML4. Script tags for HTML 5 can be written simply as: <script></script> Link to comment https://forums.phpfreaks.com/topic/270064-html5-javascript-not-working-together/#findComment-1388891 Share on other sites More sharing options...
Jessica Posted October 31, 2012 Share Posted October 31, 2012 That won't stop the script from executing The script type declaration is optional, you can still include it. Link to comment https://forums.phpfreaks.com/topic/270064-html5-javascript-not-working-together/#findComment-1388910 Share on other sites More sharing options...
haku Posted October 31, 2012 Share Posted October 31, 2012 We were speaking of 'language', not 'type'. That said, I agree that including (or not including) either of them shouldn't make a difference. But look at his current script tag: <script language=[url=""]javascript[/url]> Even assuming that the is some kind of bbcode/templating code, the script tag is messed up. Link to comment https://forums.phpfreaks.com/topic/270064-html5-javascript-not-working-together/#findComment-1388915 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.