html - Is is possible to create small dialog box onclick not alert in javascript -
i interested create small dialog box onclick this, don't want use alert
i need javascript should this
function dailog(title,text,newid,script_include) { // here html include part should come, <script src=script_include<script/> <div id=newid title=title > <p> text</p> </div> // once created print dialog in current window } i want call this
<li id="myid" onclick="dailog('mytitle','you clicked this','mycssid','/path/to/jquery-1.9.1.js')"</li> sorry bad english, hope guys understand trying achieve.
i guess want this:
http://jsfiddle.net/easwee/ajatf/
<script> function dialog(title, text, newid, script_include) { document.body.innerhtml += '<script src="' + script_include + '"><\/script>'; document.body.innerhtml += '<div id="' + newid + '" title="' + title + '"><p>' + text + '</p></div>'; } </script> <ul> <li id="myid" onclick="dialog('mytitle', 'you clicked this','mycssid','/path/to/jquery-1.9.1.js');">my li</li> </ui> edit:
with multiple script paths:
http://jsfiddle.net/easwee/8d7fj/
<script> function dialog(title, text, newid, script_include) { for(i=0; < script_include.length; i++) { document.body.innerhtml += '<script src="' + script_include[i] + '"><\/script>'; } document.body.innerhtml += '<div id="' + newid + '" title="' + title + '"><p>' + text + '</p></div>'; } </script> <ul> <li id="myid" onclick="dialog('mytitle', 'you clicked this','mycssid', ['/path/to/jquery-1.9.1.js','/path/to/anotherscript.js']);">my li</li> </ui>
Comments
Post a Comment