Jump to content

hvw3347

Members
  • Content Count

    5
  • Joined

  • Last visited

Community Reputation

0 Neutral

About hvw3347

  • Rank
    Newbie
  1. total 3 files --#1. js2.htm:<html> <head> <title>js-in-js test</title> <script type="text/javascript" src="b.js"> </script> </head> <body onload="add_script()"> <input type="button" onclick="disp_alert('Alert 1')" value="Display alert box 1" /> </body></html>#2 a.js:function disp_alert(txt){ alert(txt)}#3 b.js:function add_script(){ head = document.getElementsByTagName('head')[0]; e = document.createElement('script'); // create a script element e.type = 'text/javascript'; // set the type of the
  2. The code with ... e.src = 'a.js'; head.appendChild(e); ...works just fine. However, the last code still does not work when I try. Does it depend on the server? I have IIS 6. Thanks a lot! At least, I've got one that works.Harvey
  3. I have some troubles when using your code. If the code is:<body id="thebody"><script type="text/javascript"> document.getElementById("thebody").innerHTML += "<script type=\"text/javascript\" src=\"a.js\"></script>"</script><input type="button" onclick="disp_alert('Alert 1')" value="Display alert box 1" /></body>The page displayes as:" then, the-button [Display alert box 1]Why is " shown up? the button still does not work. Did I do anything wrong? Thanks!
  4. Hi,I try to include a javascript in another javascript, but it does not work. Below is my code, all 3 files are in the same folder. Please help to indicate the error:a.js:function disp_alert(txt){ alert(txt)}b.js:document.write('<script type="text/javascript" src="' + a.js + '"></script>'); test_js_in_js.htm:<html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><title>Test js in js</title><script language="JavaScript" type="text/javascript" src="b.js"> </script ></head><body><input type="butt
  5. Hi,I just started learning asp.net and found the ASP.NET Tutorial at this w3school web site very helpful. It provides all real codes for all topics. However, when I reached the topic "ASP.NET 2.0 - Navigation" that has a real sample "Click here to see a demo of Menu, TreeView, and SiteMapPath", I see only part of codes. I don't know how to put them together. Can somebody tell me where to get the whole codes? I appreciate all the help!Harvey
×
×
  • Create New...