freshbee Posted February 13, 2009 Share Posted February 13, 2009 Dear Friends, Can I write a function in php which includes all the javascripts. And call that function wherever necessary. Ex : [pre]class USER { public function include_js_files() { echo "<script language=javascript src=../scripts/IsValid.js></script>"; echo "<script language=javascript src=../scripts/IsAlpha.js></script>"; echo "<script language=javascript src=../scripts/IsEmail.js></script>"; } public function edit_user($user_id,$role_id) { self::include_js_files(); ..... echo "<form id=1 onsubmit='return chk_input();' method=post action='edit.php'>"; ..... ..... } }[/pre] Thanks in advance. Quote Link to comment Share on other sites More sharing options...
Prismatic Posted February 13, 2009 Share Posted February 13, 2009 You can, just make sure it gets inserted into the <head></head> of your document Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.