943,801 Members | Top Members by Rank

Ad:
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
May 2nd, 2009
0

Re: Little help, please

Click to Expand / Collapse  Quote originally posted by wattaman ...
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
Reputation Points: 21
Solved Threads: 0
Junior Poster
marjan_m is offline Offline
149 posts
since Apr 2005
May 3rd, 2009
0

Re: Little help, please

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!
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
wattaman is offline Offline
90 posts
since May 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JavaScript / DHTML / AJAX Forum Timeline: how to read form element values
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: whew. i dunno what's wrong with my work





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC