Little help, please

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Apr 2005
Posts: 149
Reputation: marjan_m is an unknown quantity at this point 
Solved Threads: 0
marjan_m marjan_m is offline Offline
Junior Poster

Re: Little help, please

 
0
  #11
May 2nd, 2009
Originally Posted by wattaman View Post
Thanks, m8. I almost got it working. So, first of all if I put the .js code in the function it doesn't load the script - just keeps loading forever.
So, tooking your suggestion, I'm using this code instead:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <script language="javascript" type="text/javascript">
  2. function calendar()
  3. {
  4. document.write("<script language='JavaSc" + "ript' src='http://atat.ro/js/calendar-ortodox.js'></sc" + "ript>")
  5. }
  6. </script>
  7. <input type="submit" onclick="calendar()" value="Calendar Ortodox" name="Calendar" />
... which works, kin of... It loads the script in a new browser window.
Can I make it load under the button, on the same page, I mean? I want the button to show on all pages and the script to load, also, on the site's pages.
BTW, here it is http://atat.ro , upper-right column, just above the social bookmark icons.
Thanks again!
Yes it can be done as:

Make a separate file for your java script code and save it with extension ".js" as it will be "filename.js"

Place that js function in that file.

Remember not to use the script tag in that separate js file.

Place the button in your html pages and just make the same function call.

Remember to include the js file in all the pages where u need to use that button and make the same function call.

A js file can be included as:

<script src="filename.js"></script>

I hope it will be helpful to you. All the best
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 18
Reputation: wattaman is an unknown quantity at this point 
Solved Threads: 0
wattaman wattaman is offline Offline
Newbie Poster

Re: Little help, please

 
0
  #12
May 3rd, 2009
M8, I don't want to load the javascript when the page loads, that's the point. Your first suggestion was good, only that it loads the script in a new file. I wanted to display, for example, just under the onclick button.
So, short story, that's what I have now:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <input type="submit" onclick="test()" />
  2. <script language="javascript" type="text/javascript">
  3. function test()
  4. {
  5. document.write("<script language='JavaSc" + "ript' src='http://atat.ro/js/calendar-ortodox.js'></sc" + "ript>")
  6. }
  7. </script>
Q: is there a way to run it on the same page so the script will display the content under the button?
Thanks!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the JavaScript / DHTML / AJAX Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC