Dynamic code in Body, after load

P

pamelafluente

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";
}


//-------------------------------
 
R

RobG

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.
 
P

pamelafluente

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/flawless-and-fast-png-support-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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top