Hi Gurus,
How can I execute a script during runtime. Here is my code, so how do I
execute the new script during runtime which should be a part of the
'topDiv'.
Thanks Help is appreciated.
- Shailendra
------- CODE ----------------
<html>
<title></title>
<script>
function GetNew() {
document.getEle mentById('topDi v').innerHTML = '';
var scElement = document.create Element('script ');
scElement.id = 'NewScript1';
scElement.langu age = 'javascript';
scElement.type = 'text/javascript';
scElement.src = 'http://somenewwebpagew hichreturnshtml .com'; //
This web page returns HTML using document.write( 'somehtml code') or
returns a flash JS code.
document.getEle mentById('topDi v').appendChild (scElement);
}
</script>
<body>
<div id='topDiv'>
<script id='Script1'
src='http://somewebpagewhic hreturnshtml.co m'></script>
</div>
<input id="Button1" type="button" value="Get New HTML"
onclick="GetNew ();" />
</body>
</html> 5 2498
This will get you started.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1"/>
<title></title>
<script type="text/javascript">
<!--
var nav = "nav1";
function SwapNav() {
document.all.na v.style.display ='none';
var elem = document.getEle mentById("nav") ;
var root = document.docume ntElement;
("nav1" == nav) ? Nav1() : Nav2();
document.all.na v.style.display ='';
}
function Nav1() {
document.all.na v.innerHTML =
document.getEle mentById("nav1" ).innerHTML;
nav = "nav2";
}
function Nav2() {
document.all.na v.innerHTML =
document.getEle mentById("nav2" ).innerHTML;
nav = "nav1";
}
//-->
</script>
<div id="nav"></div>
<input type="button" onclick="SwapNa v()" value="Swap"/>
<!-- start navs here -->
<div style="position :absolute;visib ility:hidden;ba ckground:#FFFFF F;">
<div id="nav1" >
<table border="1" width="350" bgcolor="#FFFFF F">
<tr><td bgcolor="#CCDCF 2"><p>Nav #1</p></td>
</tr>
<tr>
<td>asf af asdfas afsd fasdfasfadfa
</td>
</tr>
</table>
</div>
<div id="nav2" >
<table border="1" width="350" bgcolor="#FFFFF F">
<tr><td bgcolor="#CCDCF 2"><p>Nav #2</p></td>
</tr>
<tr>
<td>n asdf asdf asdf asdf asfasdf af asdfadf asdf asfa fasf adfa fsfad
</td>
</tr>
</table>
</div>
</div>
<script>Nav1( )</script>
</body>
</html>
Thanks Randy. Let batham be the judge of the usefulness of the code.
Aside from that, I was the only person kind enough to provide batham
suggestions.
The code shows how he can swap out navigation. All he has to do is swap
out the
contents of the div with "navigation html". I say get started because
additional
Javascript is required to actually fill the div tags with content from
the other
sites rather than from hard coded values.
Randy, has it occurred to you that the bitterness that is notable in
your posts
might impact your chances of someday finding a job? That is, assuming
you care
enough about JavascriptToolb ox to refer to it in a resume.
I can't speak for places out side the US, especially Wonderful
California,
but here responses like yours seem pointless and borderline idiotic.
thanks gimme gimme, your code sure works fine, but not what I want, I
need to dynamically or shall i say during runtime load a script which
points to a HTTP and does some magic sh$t.
I did get a working version but the calling script is so F$cked up
that it has a script within a script and another script, lets just say
people drink while they program LOL.
Anyways randy relax dude, he was just "trying" to help dude, I don't
know where you guys are at, but southern california sure rocks dude.
take it easy
shailendra batham
Well... Does the site you're trying to scrape have an RSS version of
the page you want?
If it does, review a few of the AJAX examples on the internet that use
XMLHttpRequest. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Madhav |
last post by:
I have the following statements in my script.
----------------------------------------------------------
textToWrite = "<HTML> \n" +
"<HEAD> \n" +
"<TITLE>Calendar</TITLE> \n" +
"<SCRIPT LANGUAGE=\"JavaScript1.2\"SRC=\"popWin.js\">"+
"</SCRIPT> \n" +
"</HEAD> \n" +
"<BODY> \n" ;
textToWrite += "<\BODY>\n" +
|
by: MPennig |
last post by:
Here's my situation. I have a function defined in my document's <head>
section which adds a <script> tag to a specified <div> tag. The added
<script> has a src="" attribute pointing to a PHP file, which
dynamically returns JavaScript. In Safari, the src file isn't
downloaded. Neither is any code contained within the new script tag
. In IE(6) and Firefox, this works as expected.
Here's my code. I hope it will better illustrate what I'm...
|
by: hemant.singh |
last post by:
Hello all,
I am try'g to send window.location.href to the server script who will
generate dynamic javascript according to the referral name comg in as
param
Now bcz
<script language="javascript" src="NO JAVASCRIPT CAN BE USED HERE" />
So I am see'g If I can use eval todo something what I am doing
I have tried almost everything, following is being last one
|
by: Iddo |
last post by:
Hi,
I am having a strange problem...
I have an HTML file which has 2 script tags:
1) <script language="javascript" id="ABC" src="ABC.js" />
2) <script id="general" language="javascript">
function foo()
{
alert("aaa");
}
</script>
|
by: rhythmace |
last post by:
W3C HTML validator passes this:
....
<script type="text/javascript" src="foo.js">
<script type="text/javascript">
....script in here...
</script>
....
| |
by: max |
last post by:
Hi
I want to load an external file into my page via XMLhttpRequest and
innerHTML.
The external file contains javascript code which is not executed during
or after insertion. All the HTML markup is displayed just fine....
basicly even this code doesnt work:
<div id='tmp'>original Content</div>
<script>
|
by: -Karl |
last post by:
Couls someone please advise me on this error. What I am trying to do
is be able to convert an XML document into arrays. I read that the
subs & functions have to be in <scripttags.
Thanks!
Error:
BC30456: 'Read_DOM' is not a member of
|
by: Gretsch |
last post by:
I have a lot of nicely formatted HTML to be displayed for visitors WITHOUT script (/enabled), and a second set of HTML for those WITH script.
The <noscript> tag allows me to separate the HTML for those without script,
How can I separate the HTML for those with script? (ie not run for those without script enabled.
The only way I've found so far is:
...
<noscript>
This should only be diplayed when scripting is not configured
|
by: labmonkey111 |
last post by:
I'm having trouble with the following code:
<SCRIPT>
<!--
if (navigator.appName == 'Microsoft Internet Explorer') {
document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"templates/94076/menu.css\" media=\"screen, print\" />");
document.write("<script src=\"templates/94076/menu.js\" language=\"javascript\" type=\"text/javascript\"></script>");
} else {
document.write("<link rel=\"stylesheet\" type=\"text/css\"...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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,...
| |
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...
|
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,...
|
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...
|
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...
|
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...
|
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();...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |