Jul 21, 2003 #1 yytan Programmer May 8, 2002 113 MY hi there; in my jsp file, i did this <script language="javascript" src="include.js"></script> but can i have a short example how to call the method in include.js from the jsp file?
hi there; in my jsp file, i did this <script language="javascript" src="include.js"></script> but can i have a short example how to call the method in include.js from the jsp file?
Jul 21, 2003 #2 sedj Programmer Aug 6, 2002 5,610 In a javascript block ... <script language="javascript"> myFunction(); </script> or within some HTML ... <input type="submit" onClick="myFunction"> Upvote 0 Downvote
In a javascript block ... <script language="javascript"> myFunction(); </script> or within some HTML ... <input type="submit" onClick="myFunction">
Jul 21, 2003 Thread starter #3 yytan Programmer May 8, 2002 113 MY hi; i know how to use javascript in jsp. but what if i put the whole javascript into a fil let say include.js so how to use it from jsp? how to call the include.js function inside the jsp. Upvote 0 Downvote
hi; i know how to use javascript in jsp. but what if i put the whole javascript into a fil let say include.js so how to use it from jsp? how to call the include.js function inside the jsp.
Jul 22, 2003 #4 sedj Programmer Aug 6, 2002 5,610 Yes. I know what you mean !!!!! As I said before, In a javascript block ... <script language="javascript"> myFunction(); </script> or within some HTML ... <input type="submit" onClick="myFunction"> Upvote 0 Downvote
Yes. I know what you mean !!!!! As I said before, In a javascript block ... <script language="javascript"> myFunction(); </script> or within some HTML ... <input type="submit" onClick="myFunction">
Jul 22, 2003 Thread starter #5 yytan Programmer May 8, 2002 113 MY ok, will try out that... Upvote 0 Downvote
Jul 22, 2003 Thread starter #6 yytan Programmer May 8, 2002 113 MY hi there; i am having error here. it said object expected? pls point out where is my error, thanks. ---fisrt.jsp--- <%@ page language="java" %> <%@ page import="java.util.*" %> <!DOCTYPE HTML PUBLIC "-//w3c//dtd html 4.0 transitional//en"> <html> <head> <title>Lomboz JSP</title> <SCRIPT LANGUAGE="JavaScript src="first.js"> chk(); </SCRIPT> </head> <body bgcolor="#FFFFFF"> <br><center>Time now: <%= new Date() %></center> <% out.println("hello..." %> <form name="firstForm"> <input tpye="text" name="name"> <input type="button" value=" OK " onClick="chk()"> </form> </body> </html> ----first.js---- function chk() { var txt = document.firstForm.name.value; if (txt.length < 1) { alert("please key in your name" document.firstForm.name.focus(); } else alert ("hi ... " + txt); } Upvote 0 Downvote
hi there; i am having error here. it said object expected? pls point out where is my error, thanks. ---fisrt.jsp--- <%@ page language="java" %> <%@ page import="java.util.*" %> <!DOCTYPE HTML PUBLIC "-//w3c//dtd html 4.0 transitional//en"> <html> <head> <title>Lomboz JSP</title> <SCRIPT LANGUAGE="JavaScript src="first.js"> chk(); </SCRIPT> </head> <body bgcolor="#FFFFFF"> <br><center>Time now: <%= new Date() %></center> <% out.println("hello..." %> <form name="firstForm"> <input tpye="text" name="name"> <input type="button" value=" OK " onClick="chk()"> </form> </body> </html> ----first.js---- function chk() { var txt = document.firstForm.name.value; if (txt.length < 1) { alert("please key in your name" document.firstForm.name.focus(); } else alert ("hi ... " + txt); }
Jul 22, 2003 #7 sedj Programmer Aug 6, 2002 5,610 You have missed a quote mark :: <SCRIPT LANGUAGE="JavaScript src="first.js"> should be :: <SCRIPT LANGUAGE="JavaScript" src="first.js"> Upvote 0 Downvote
You have missed a quote mark :: <SCRIPT LANGUAGE="JavaScript src="first.js"> should be :: <SCRIPT LANGUAGE="JavaScript" src="first.js">
Jul 22, 2003 Thread starter #8 yytan Programmer May 8, 2002 113 MY thanks, i got it work Upvote 0 Downvote