473,769 Members | 5,601 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how-to reload variable value in page when external js file changed

Hi javascript gurus,
I have a simple html file (simple.html) with
javascript. In html page there is sentence from
variable defined in .js file (myFirst.js). Once I
reload another .js file (mySecond.js), the value
defined in the second one is NOT reloaded into html
page.
Please help out what's wrong in my code.
BTW, I use IE6.0

Many thanks!

Code in simple.html
--------------
<html>
<head>
<script language='javas cript' type='text/javascript' id='myScript' src='myFirst.js '>
</script>
<script language='javas cript' type='text/javascript'>
function reload(order){
mySrc = "my"+order+".js "
document.getEle mentById('myScr ipt').src = mySrc
alert("Your order: "+order+" and my SRC: "+mySrc+" and "+great)
}
reload("First")
</script>
</head>
<body>
<script language='javas cript' type='text/javascript'>
document.write( great)
</script>
<form>
<p>Reload greating:
<input type="button" value="Reload, please!"
onclick='reload ("Second")'> </p>
</form>
</body>
</html>

myFirst.js
----------
var great="First Greeting: Hello Internet!"

mySecond.js
-----------
var great="The Second Greeting: Hello Internet!"
zdhiu
Jul 20 '05 #1
1 4821
zd***@yahoo.com (zdhiu) wrote in message news:<ea******* *************** ****@posting.go ogle.com>...
Hi javascript gurus,
I have a simple html file (simple.html) with
javascript. In html page there is sentence from
variable defined in .js file (myFirst.js). Once I
reload another .js file (mySecond.js), the value
defined in the second one is NOT reloaded into html
page.
Please help out what's wrong in my code.
BTW, I use IE6.0

Many thanks!

Code in simple.html
--------------
<html>
<head>
<script language='javas cript' type='text/javascript' id='myScript' src='myFirst.js '>
</script>
<script language='javas cript' type='text/javascript'>
function reload(order){
mySrc = "my"+order+".js "
document.getEle mentById('myScr ipt').src = mySrc
alert("Your order: "+order+" and my SRC: "+mySrc+" and "+great)
}
reload("First")
</script>
</head>
<body>
<script language='javas cript' type='text/javascript'>
document.write( great)
</script>
<form>
<p>Reload greating:
<input type="button" value="Reload, please!"
onclick='reload ("Second")'> </p>
</form>
</body>
</html>

myFirst.js
----------
var great="First Greeting: Hello Internet!"

mySecond.js
-----------
var great="The Second Greeting: Hello Internet!"
zdhiu


It seems that my bad description in this post; or nobody has this
problem | don't know this problem here.

Anyway, I got solution and fix it.
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2982
by: Tom Szabo | last post by:
Just wandering how can you close a browser remotely. In some web applications the browser closes or refreshes periodically. How is that done and how can it be done through PHP? TIA, Tom
15
16336
by: Reid Nichol | last post by:
Hello, I was wondering if I could control how many bytes are in an int and the byte order. In C/C++ I can use int32 but how do I do this in python? How can I control byte order?
0
1827
by: v I n O | last post by:
hI Geeks Please do let me know how do i find how many instances sql server running on the single machine. or in the n/w my objective should with help of C#/vb.net
4
2030
by: James Salisbury | last post by:
Hi, I was checking my parent's website salisbury.cabrera.net on google by entering villa rent spain cabrera I can see the required site, ranked at 4, but I am concerend by the return at 1 and 5 in the list. Any ideas why somone else may be using the text from my site, and how can I make an abuse report? Thanks
4
1984
by: | last post by:
Developing, building, and testing. How do it the best? Learning from the world leader - Microsoft I'm very interested in how the developing/build/testing workflow @ Microsoft looks like. I think Microsoft as world leader in software developing business must have a very good workflow. Does anyone know how the development flow @ Microsoft looks like?
2
3064
by: flywave | last post by:
hi,who can help me ?i came into a problem that how can i get a packet which was send in the LAN.in a word ,how the sniffer works. I once used the rawsocket in win2000 or xp,and it do catch. but the packet is IP packet,not including the MAC address. then how can i catch a packet include the MAC address from the linking layer.in what ways? thanks every one.
4
4842
by: nsj | last post by:
How shall i use quotation marks within another in asp.net?
7
2582
by: anushhprabu | last post by:
#define q(k)main(){ return!puts(#k"\nPRABUq("#k")");} q(#define q(k)main(){return!puts(#k"\nq("#k")");}) guys i'm working on this code.. i got it fromnet.. how this is working.. anyone pls.. it is printing the same content on screen.. how ya.. how it is.. how how how?? please...................
0
1987
by: candra | last post by:
Learn What Hackers Know? -General Hacking Information -Password Security -Scanning, Fingerprinting And Similar Techniques -How Hackers Attack Numerous Internet Services -How Hackers Attack Web Servers, Cgis, PHP, ASP, Etc -How Hackers Attack IRC, Instant Messaging, And Multiplayer Games -Vulnerabilities Found In Platforms With Smaller Market Share -How Hackers Attack Novell And Networks
2
1617
by: belred | last post by:
i just read this blog about how many objects (types) are loaded for a hello world program in C#. http://blogs.msdn.com/abhinaba/archive/2008/09/15/how-many-types-are-loaded-for-hello-world.aspx how can you find out how many are loaded for a python program: print 'hello'
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10045
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9993
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9863
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8870
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7406
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5298
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3958
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.