If I take a website that has body text and <scripttags, I can do:
document.body.i nnerHTML = document.body.i nnerHTML.replac e("no","yes") ;
but if i want to change the script as such
document.body.i nnerHTML =
document.body.i nnerHTML.replac e("alert\(\"no\ "\)","alert\(\" yes\"\)");
I can't - how can I get to the section with the javascript in it? 1 1141
Jarry wrote:
If I take a website that has body text and <scripttags, I can do:
document.body.i nnerHTML = document.body.i nnerHTML.replac e("no","yes") ;
but if i want to change the script as such
document.body.i nnerHTML =
document.body.i nnerHTML.replac e("alert\(\"no\ "\)","alert\(\" yes\"\)");
I can't - how can I get to the section with the javascript in it?
The short answer is: for all practical purposes, you can't.
innerHTML is a non-standard property of DOM elements introduced by
Microsoft in IE. It has been widely copied by other browsers to the
extent that it is a /de facto/ standard, however, there is no public
specification for it and implementations vary.
It should only be used with simple HTML to create fully-formed DOM
objects that replace or are appended to existing DOM elements.
Replacing an element's innerHTML property does not cause code within
script elements to be executed, although some libraries include methods
to do so[1].
You might employ those methods for your attempted replacement trick,
however unless scripts are written to be executed that way, results
will be unpredictable.
1. Script elements are collected using a regular expression and their
content eval'd. A fairly crude but reliable mechanism that has some
foibles for the unwary.
Try this thread:
<URL: http://groups.google.com.au/group/co...f42490c301de/#
>
--
Rob This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: LRW |
last post by:
Sorry to crosspost, but I have no idea if this is more a PHP question
of general Linux question.
I have a script that makes changes to image files, montages them into
a jpg, and creates a Web page with that image.
It starts with someone from our graphics dept. who I set up to copy
the image files over to the Linux server with SAMBA.
The files gain the owner/group of "nobody" and permissions of 744.
|
by: Jim Marquardson |
last post by:
Hi,
I've struggled with this for a while now, so I'm asking for help. I
am trying to click on a link in one page, have that link open up in a
new window, and set that newly opened window's ifram to a specific
url. Here is the code I'm using:
<html>
<head>
|
by: rpesq |
last post by:
Hi,
I Need help changing the content of a DIV. I sincerely researched the
issue and have not found a solution except to scrap the idea and stick
with the iframe code that I had been using. My purpose here is to
avoid iframes.
I know how to change the DIV content to other basic html statements,
such as basic IMG's or Lists, but I want to put a Javascript into the
DIV, and have not found a way to do it.
|
by: Gopal |
last post by:
Hi,
I've a module report.py having a set of funtions to open/close/write
data to a log file. I invoke these functions from another module
script.py.
Whenever I'm changing something in report.py, I'm running the file
(however, it has not effect). After that I'm running script.py again.
However, the output is not taking effect.
|
by: Stefan Finzel |
last post by:
Hi,
is there a way to change the display property on Windows Mobile 2003 SE
Mobile/Pocket Internet Explorer? See following example.
Please note: visibilty property has the same problem.
Is there any other way to display/undisplay parts of web pages?
TIA
| |
by: GaryDean |
last post by:
In the original post I failed so indicate that I am using framework
1.1.......
I need to be able to change the background color of a page from code. I
found an answer to this question in another forum from Peter Huang that said
that an id="bg" as follows...
<body MS_POSITIONING="GridLayout" runat="server" id="bg">
then we could do the following in our codebehind file....
|
by: libsfan01 |
last post by:
hey this code wont work for my iframe in safari, i cant change the page
by changing the src with js:
<script language="javascript">
function loadcontent(page) {
document.getElementById('iframeid').src = page;
}
</script>
|
by: Velislav |
last post by:
Hi,
I have a client script block, which is registered in my Page_Load.
However a button may result in the need to change the script which I've
registered.
Obviously the OnClick event occurs after Page_Load, so calling
RegisterClientScriptBlock with the same key does nothing.
|
by: bulldog8 |
last post by:
I am having problems with changing a frames source file for Mozilla
(1.5.0.4). The followig code works for IE:
<script type="text/javascript">
var imgP = new Image();
function ShowPic(ShowThis, wdth, hght) {
imgP.src = "../pics/' + ShowThis + '"
xw = 500;
yh = 500*(hght/wdth);
window.document.getElementById("graphic").innerHTML = '<img src="../
|
by: Ajm113 |
last post by:
I find it odd all my scripts doesn't change the logged in person's name on any other page, but my threads page. I have no idea why! I looked over the script and saw nothing changing the session (Variable Wise) changing it.
I commented out some off the parts on my large script, but it seems the problem points to here though it doesn't make sence.
It looks it's changing the myemail session.
<?
if(@$_SESSION != "") {
print "<a...
|
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: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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: 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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |