473,385 Members | 1,523 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Dynamic code in Body, after load


Hi guys,
I am trying to add some code in the body of a document just
after it has loaded. I have the following code (this is referenced in
an html page).

When I click on the document I receive this error: "realSrc is null"

I guess I am not doing correctly the part of dynamic code. Can you help
?
//-------------------------------
var submitURL = "../../MyEngine/MyProcessor.aspx";
var HiddenFieldID = "actionCodes";

window.onload = addCellHandlers;

function addCellHandlers() {

//some code here to add some dynamic handlers
document.body.innerHTML += "<form name='form1'
method='get'><input type='hidden' id=" + HiddenFieldID + "/></form>"
document.form1.action = submitURL;

window.status = "Handlers attacched";
}
//-------------------------------

Jan 17 '07 #1
2 7314
pa***********@libero.it wrote:
Hi guys,
I am trying to add some code in the body of a document just
after it has loaded. I have the following code (this is referenced in
an html page).

When I click on the document I receive this error: "realSrc is null"

I guess I am not doing correctly the part of dynamic code. Can you help
?
As far as I can tell, the error is not caused by the code you have
posted, though it may be related in some way to what you haven't
posted.
>

//-------------------------------
var submitURL = "../../MyEngine/MyProcessor.aspx";
var HiddenFieldID = "actionCodes";

window.onload = addCellHandlers;

function addCellHandlers() {

//some code here to add some dynamic handlers
Your error is likely related to the above missing code.
--
Rob

Jan 18 '07 #2

RobG ha scritto:

As far as I can tell, the error is not caused by the code you have
posted, though it may be related in some way to what you haven't
posted.


Actually you are right. I am also using:

http://webfx.eae.net/dhtml/pngbehavior/pngbehavior.html

to fix png transparency in ie6. if you see the script on that page
there is a point:

// check for real change
if (src == realSrc) {
element.src = blankSrc;
return;
here the code gives error because it finds realSrc Null.

Actually I have no idea how to fix this.
Let's forget about it, because ...
.... I have also find another way to fix the transparency problem.
It's quite the same trick but probably better implemented.
I can see less flickering.

It is here:

http://blog.bjorkoy.com/2006/12/12/f...upport-in-ie6/
BUT... even with this second method my simple dynamic code does NOT
work.

There must be some interference between the dynamic code

document.body.innerHTML += "<form name='form1'
method='get'><input type='hidden' id=" + HiddenFieldID + "/></form>"
document.form1.action = submitURL;

and the component code.
But I do not know javascript well enough to fix it.

Does anybody know ??

-Pam
------------------ here is the component

<public:component>
<public:attach event="onpropertychange" onevent="doFix()" />

<script type="text/javascript">

// IE5.5+ PNG Alpha Fix v1.0RC4
// (c) 2004-2005 Angus Turnbull http://www.twinhelix.com

// This is licensed under the CC-GNU LGPL, version 2.1 or later.
// For details, see: http://creativecommons.org/licenses/LGPL/2.1/
// This must be a path to a blank image. That's all the configuration
you need.
if (typeof blankImg == 'undefined') var blankImg = 'blank.gif';
var f = 'DXImageTransform.Microsoft.AlphaImageLoader';

function filt(s, m)
{
if (filters[f])
{
filters[f].enabled = s ? true : false;
if (s) with (filters[f]) { src = s; sizingMethod = m }
}
else if (s) style.filter =
'progid:'+f+'(src="'+s+'",sizingMethod="'+m+'")';
}

function doFix()
{
// Assume IE7 is OK.
if (!/MSIE (5\.5|6\.)/.test(navigator.userAgent) ||
(event && !/(background|src)/.test(event.propertyName))) return;

var bgImg = currentStyle.backgroundImage || style.backgroundImage;

if (tagName == 'IMG')
{
if ((/\.png$/i).test(src))
{
if (currentStyle.width == 'auto' && currentStyle.height == 'auto')
style.width = offsetWidth + 'px';
filt(src, 'scale');
src = blankImg;
}
else if (src.indexOf(blankImg) < 0) filt();
}
else if (bgImg && bgImg != 'none')
{
if (bgImg.match(/^url[("']+(.*\.png)[)"']+$/i))
{
var s = RegExp.$1;
if (currentStyle.width == 'auto' && currentStyle.height == 'auto')
style.width = offsetWidth + 'px';
style.backgroundImage = 'none';
filt(s, 'crop');
// IE link fix.
for (var n = 0; n < childNodes.length; n++)
if (childNodes[n].style) childNodes[n].style.position = 'relative';
}
else filt();
}
}

doFix();

</script>
</public:component>

Jan 18 '07 #3

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

Similar topics

1
by: rh | last post by:
Executing the script given below Opera, Netscape and Mozilla successfully load the js file in both the "main" and "test" window. However, while IE 6 manages to load OK in "main", it produces the...
3
by: Jack Black | last post by:
Using VS.Net 2k3 to build ASP.Net app with VB code-behind pages... Hi, all! I've been struggling with getting a dynamically-generated CheckBoxList generated. I've finally been able to get the...
7
by: John | last post by:
Hi all, I need finality on this once and for all please. I have a main page which contains a couple of placeholders and within these placeholders, depending on what the user presses, I load...
7
by: Jo | last post by:
Hi, How can i differentiate between static and dynamic allocated objects? For example: void SomeFunction1() { CObject *objectp = new CObject; CObject object;
13
by: bgraphics2031 | last post by:
I'm trying to get this iframe to dynamically resize by dragging a vertical bar, but it's not working in Mozilla (It originally worked in IE but I've been trying to port it over). Any help will be...
9
by: pbd22 | last post by:
Hi. This is just a disaster management question. I am using XMLHTTP for the dynamic loading of content in a very crucial area of my web site. Same as an IFrame, but using XMLHTTP and a DIV. I...
9
by: dli07 | last post by:
Hello, I'm trying to convert a piece of code that creates a dynamic vertical resizing bar in a table from internet explorer to firefox. It's based on a post from...
4
by: =?Utf-8?B?RHlsYW5TbWl0aA==?= | last post by:
I have a WebForm where I'm dynamically creating some controls and I'm having difficulty understanding how the state is being persisted and how to work with it. I've created a simplified example...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.