PC Review


Reply
Thread Tools Rate Thread

<Object> Is undefined

 
 
Sam Samnah
Guest
Posts: n/a
 
      13th Jun 2005
I posted this during the weekend and I think it was missed so I am posting
it again. I'm in real big trouble with this and need help desperately. Any
suggestions will be met with unbelievable gratitude.
I don't know why but on the outputed page the dialog helper id is not
recognized or is "undefined" Can someone tell suggest what I am doing
wrong? I've been going over this goodness knows how many times and I can't
figure it out. The Object is set on the page properly but is not recognized
in the javascript. Some one please help.

Below is the code.

Thank you in advance,

Sam I am-

protected override void OnLoad(EventArgs e)

{

base.OnLoad (e);

if(!Page.IsClientScriptBlockRegistered("startup"))

{

StringBuilder jsload=new StringBuilder();

jsload.Append(@"<script language='javascript' type='text/javascript'>" +
"\n");

jsload.Append(@"window.onload=doInit;" + "\n");

jsload.Append(@"function doInit()" + "\n");

jsload.Append(@"{" + "\n");

jsload.Append("\t" + @"for(i=0;i<document.all.length;i++)" + "\n");

jsload.Append("\t\t" + @"document.all(i).unselectable = 'on';" + "\n");

jsload.Append("\t\t" + @"oDiv.unselectable = 'off';" + "\n");

jsload.Append("\t\t" + @"oDiv.innerHTML='';" +"\n");

jsload.Append("\t\t" + @"oDiv.focus();" + "\n");

jsload.Append("\t\t" + @"getSystemFonts();" + "\n");

jsload.Append(@"}" + "\n");

jsload.Append(@"function callFormating(sformatString)" + "\n" + "{" + "\n");

jsload.Append("\t" + @"document.execCommand(sformatString);" + "\n");

jsload.Append(@"}" + "\n");

jsload.Append(@"function moveCurser(" + this.UniqueID + ")" + "\n" + "{" +
"\n");

jsload.Append("\t" + @"var i;" + "\n");

jsload.Append("\t" + @"i=document.getElementById('oDiv');" + "\n");

jsload.Append("\t" + this.UniqueID + @".value=i.innerHTML;" + "\n");

jsload.Append(@"}" + "\n");

This the problem javascript:

jsload.Append(@"function getSystemFonts()" + "\n" + "{" + "\n");

jsload.Append("\t" + @"var a=dlgHelper.fonts.count;" + "\n");

jsload.Append("\t" + @"var fArray=new fArray();" + "\n");

jsload.Append("\t" + @"var
oDropDown=document.getElementByID(oToolbar1).createDropDownListAt('1');" +
"\n");

jsload.Append("\t" + @"oDropDown.setAttribute('ID','FontNameList');" +
"\n");

jsload.Append("\t" + @"for(i=1;i<dlgHelper.fonts.count;i++)" + "\n" + "\t" +
"{" + "\n");

jsload.Append("\t\t" + @"fArray[i] = dlgHelper.fonts(i);" + "\n");

jsload.Append("\t\t" + @"var aOptions = oDropDown.getOptions();" + "\n");

jsload.Append("\t\t" + @"var oOption = document.createElement('OPTION');" +
"\n");

jsload.Append("\t\t" + @"aOptions.add(oOption);" + "\n");

jsload.Append("\t\t" + @"oOption.text = fArray[i];" + "\n");

jsload.Append("\t\t" + @"oOption.Value = i;" + "\n" + "\t" + "}" + "\n");

jsload.Append("\t" + @"oDropDown.setAttribute('onchange',ChangeFormat);" +
"\n" + "}" + "\n");

jsload.Append(@"function ChangeFormat()" + "\n" + "{" + "\n");

jsload.Append("\t" + @"var
sSelected2=document.getElementById(FontNameList);" + "\n");

jsload.Append("\t" + @"var
sSelected3=sSelected2.Options(sSelected2.selectedIndex);" + "\n");

jsload.Append("\t" +
@"document.execCommand('FontName',false,sSelected3.text);" + "\n");

jsload.Append("}" + "\n");

jsload.Append(@"function changeFontSize(strid)" + "\n" + "{" + "\n");

jsload.Append("\t" + @"var sSelected1=document.getElementById(strid);" +
"\n");

jsload.Append("\t" + @"var
sSelected=sSelected1.options(sSelected1.selectedIndex);" + "\n");

jsload.Append("\t" +
@"document.execCommand('FontSize',false,sSelected.value);" + "\n");

jsload.Append(@"}" + "\n");

jsload.Append(@"</script>" + "\n");


string CMSUpReg=jsload.ToString();

Page.RegisterClientScriptBlock("Startup",CMSUpReg);

}

}

This is the where the object is rendered

protected override void OnPreRender(EventArgs e)

{

base.OnPreRender (e);

if(!Page.IsClientScriptBlockRegistered("jObject"))

{

StringBuilder jsObject=new StringBuilder();

jsObject.Append(@"<Object id='dlgHelper'
CLASSID='clsid:3050f819-98b5-11cf-bb82-00aa00bdce0b' Width='0'
Height='0'></Object>" + "\n");

string strjsObject=jsObject.ToString();

Page.RegisterClientScriptBlock("jObject",strjsObject);

}

}


 
Reply With Quote
 
 
 
 
Scott Allen
Guest
Posts: n/a
 
      13th Jun 2005
Hi Sam:

It might be easier to debug if you did a View -> Source on the page
and posted the resulting JavaScript. I'm assuming this is an error
that occurs in the java script itself?

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Mon, 13 Jun 2005 08:15:25 -0400, "Sam Samnah"
<(E-Mail Removed)> wrote:

>I posted this during the weekend and I think it was missed so I am posting
>it again. I'm in real big trouble with this and need help desperately. Any
>suggestions will be met with unbelievable gratitude.
>I don't know why but on the outputed page the dialog helper id is not
>recognized or is "undefined" Can someone tell suggest what I am doing
>wrong? I've been going over this goodness knows how many times and I can't
>figure it out. The Object is set on the page properly but is not recognized
>in the javascript. Some one please help.
>
>Below is the code.
>
>Thank you in advance,
>
>Sam I am-
>
>protected override void OnLoad(EventArgs e)
>
>{
>
>base.OnLoad (e);
>
>if(!Page.IsClientScriptBlockRegistered("startup"))
>
>{
>
>StringBuilder jsload=new StringBuilder();
>
>jsload.Append(@"<script language='javascript' type='text/javascript'>" +
>"\n");
>
>jsload.Append(@"window.onload=doInit;" + "\n");
>
>jsload.Append(@"function doInit()" + "\n");
>
>jsload.Append(@"{" + "\n");
>
>jsload.Append("\t" + @"for(i=0;i<document.all.length;i++)" + "\n");
>
>jsload.Append("\t\t" + @"document.all(i).unselectable = 'on';" + "\n");
>
>jsload.Append("\t\t" + @"oDiv.unselectable = 'off';" + "\n");
>
>jsload.Append("\t\t" + @"oDiv.innerHTML='';" +"\n");
>
>jsload.Append("\t\t" + @"oDiv.focus();" + "\n");
>
>jsload.Append("\t\t" + @"getSystemFonts();" + "\n");
>
>jsload.Append(@"}" + "\n");
>
>jsload.Append(@"function callFormating(sformatString)" + "\n" + "{" + "\n");
>
>jsload.Append("\t" + @"document.execCommand(sformatString);" + "\n");
>
>jsload.Append(@"}" + "\n");
>
>jsload.Append(@"function moveCurser(" + this.UniqueID + ")" + "\n" + "{" +
>"\n");
>
>jsload.Append("\t" + @"var i;" + "\n");
>
>jsload.Append("\t" + @"i=document.getElementById('oDiv');" + "\n");
>
>jsload.Append("\t" + this.UniqueID + @".value=i.innerHTML;" + "\n");
>
>jsload.Append(@"}" + "\n");
>
>This the problem javascript:
>
>jsload.Append(@"function getSystemFonts()" + "\n" + "{" + "\n");
>
>jsload.Append("\t" + @"var a=dlgHelper.fonts.count;" + "\n");
>
>jsload.Append("\t" + @"var fArray=new fArray();" + "\n");
>
>jsload.Append("\t" + @"var
>oDropDown=document.getElementByID(oToolbar1).createDropDownListAt('1');" +
>"\n");
>
>jsload.Append("\t" + @"oDropDown.setAttribute('ID','FontNameList');" +
>"\n");
>
>jsload.Append("\t" + @"for(i=1;i<dlgHelper.fonts.count;i++)" + "\n" + "\t" +
>"{" + "\n");
>
>jsload.Append("\t\t" + @"fArray[i] = dlgHelper.fonts(i);" + "\n");
>
>jsload.Append("\t\t" + @"var aOptions = oDropDown.getOptions();" + "\n");
>
>jsload.Append("\t\t" + @"var oOption = document.createElement('OPTION');" +
>"\n");
>
>jsload.Append("\t\t" + @"aOptions.add(oOption);" + "\n");
>
>jsload.Append("\t\t" + @"oOption.text = fArray[i];" + "\n");
>
>jsload.Append("\t\t" + @"oOption.Value = i;" + "\n" + "\t" + "}" + "\n");
>
>jsload.Append("\t" + @"oDropDown.setAttribute('onchange',ChangeFormat);" +
>"\n" + "}" + "\n");
>
>jsload.Append(@"function ChangeFormat()" + "\n" + "{" + "\n");
>
>jsload.Append("\t" + @"var
>sSelected2=document.getElementById(FontNameList);" + "\n");
>
>jsload.Append("\t" + @"var
>sSelected3=sSelected2.Options(sSelected2.selectedIndex);" + "\n");
>
>jsload.Append("\t" +
>@"document.execCommand('FontName',false,sSelected3.text);" + "\n");
>
>jsload.Append("}" + "\n");
>
>jsload.Append(@"function changeFontSize(strid)" + "\n" + "{" + "\n");
>
>jsload.Append("\t" + @"var sSelected1=document.getElementById(strid);" +
>"\n");
>
>jsload.Append("\t" + @"var
>sSelected=sSelected1.options(sSelected1.selectedIndex);" + "\n");
>
>jsload.Append("\t" +
>@"document.execCommand('FontSize',false,sSelected.value);" + "\n");
>
>jsload.Append(@"}" + "\n");
>
>jsload.Append(@"</script>" + "\n");
>
>
>string CMSUpReg=jsload.ToString();
>
>Page.RegisterClientScriptBlock("Startup",CMSUpReg);
>
>}
>
>}
>
>This is the where the object is rendered
>
>protected override void OnPreRender(EventArgs e)
>
>{
>
>base.OnPreRender (e);
>
>if(!Page.IsClientScriptBlockRegistered("jObject"))
>
>{
>
>StringBuilder jsObject=new StringBuilder();
>
>jsObject.Append(@"<Object id='dlgHelper'
>CLASSID='clsid:3050f819-98b5-11cf-bb82-00aa00bdce0b' Width='0'
>Height='0'></Object>" + "\n");
>
>string strjsObject=jsObject.ToString();
>
>Page.RegisterClientScriptBlock("jObject",strjsObject);
>
>}
>
>}
>


 
Reply With Quote
 
 
 
 
=?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBN
Guest
Posts: n/a
 
      13th Jun 2005
It looks like a JS error, so you will have to render the page and pull the
JavaScript to see what is or is not being loaded. Walk through the JavaScript
rendered, line by line, and see if you can spot the error.

A second suggestion is step through the code line by line and look at what
variables are set. You might see a mistake in your thinking here.

It is increasingly hard to determine errors when part of your code is behind
the scenes (server code) and part is in front (client code) as the error can
be on either side.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************


"Sam Samnah" wrote:

> I posted this during the weekend and I think it was missed so I am posting
> it again. I'm in real big trouble with this and need help desperately. Any
> suggestions will be met with unbelievable gratitude.
> I don't know why but on the outputed page the dialog helper id is not
> recognized or is "undefined" Can someone tell suggest what I am doing
> wrong? I've been going over this goodness knows how many times and I can't
> figure it out. The Object is set on the page properly but is not recognized
> in the javascript. Some one please help.
>
> Below is the code.
>
> Thank you in advance,
>
> Sam I am-
>
> protected override void OnLoad(EventArgs e)
>
> {
>
> base.OnLoad (e);
>
> if(!Page.IsClientScriptBlockRegistered("startup"))
>
> {
>
> StringBuilder jsload=new StringBuilder();
>
> jsload.Append(@"<script language='javascript' type='text/javascript'>" +
> "\n");
>
> jsload.Append(@"window.onload=doInit;" + "\n");
>
> jsload.Append(@"function doInit()" + "\n");
>
> jsload.Append(@"{" + "\n");
>
> jsload.Append("\t" + @"for(i=0;i<document.all.length;i++)" + "\n");
>
> jsload.Append("\t\t" + @"document.all(i).unselectable = 'on';" + "\n");
>
> jsload.Append("\t\t" + @"oDiv.unselectable = 'off';" + "\n");
>
> jsload.Append("\t\t" + @"oDiv.innerHTML='';" +"\n");
>
> jsload.Append("\t\t" + @"oDiv.focus();" + "\n");
>
> jsload.Append("\t\t" + @"getSystemFonts();" + "\n");
>
> jsload.Append(@"}" + "\n");
>
> jsload.Append(@"function callFormating(sformatString)" + "\n" + "{" + "\n");
>
> jsload.Append("\t" + @"document.execCommand(sformatString);" + "\n");
>
> jsload.Append(@"}" + "\n");
>
> jsload.Append(@"function moveCurser(" + this.UniqueID + ")" + "\n" + "{" +
> "\n");
>
> jsload.Append("\t" + @"var i;" + "\n");
>
> jsload.Append("\t" + @"i=document.getElementById('oDiv');" + "\n");
>
> jsload.Append("\t" + this.UniqueID + @".value=i.innerHTML;" + "\n");
>
> jsload.Append(@"}" + "\n");
>
> This the problem javascript:
>
> jsload.Append(@"function getSystemFonts()" + "\n" + "{" + "\n");
>
> jsload.Append("\t" + @"var a=dlgHelper.fonts.count;" + "\n");
>
> jsload.Append("\t" + @"var fArray=new fArray();" + "\n");
>
> jsload.Append("\t" + @"var
> oDropDown=document.getElementByID(oToolbar1).createDropDownListAt('1');" +
> "\n");
>
> jsload.Append("\t" + @"oDropDown.setAttribute('ID','FontNameList');" +
> "\n");
>
> jsload.Append("\t" + @"for(i=1;i<dlgHelper.fonts.count;i++)" + "\n" + "\t" +
> "{" + "\n");
>
> jsload.Append("\t\t" + @"fArray[i] = dlgHelper.fonts(i);" + "\n");
>
> jsload.Append("\t\t" + @"var aOptions = oDropDown.getOptions();" + "\n");
>
> jsload.Append("\t\t" + @"var oOption = document.createElement('OPTION');" +
> "\n");
>
> jsload.Append("\t\t" + @"aOptions.add(oOption);" + "\n");
>
> jsload.Append("\t\t" + @"oOption.text = fArray[i];" + "\n");
>
> jsload.Append("\t\t" + @"oOption.Value = i;" + "\n" + "\t" + "}" + "\n");
>
> jsload.Append("\t" + @"oDropDown.setAttribute('onchange',ChangeFormat);" +
> "\n" + "}" + "\n");
>
> jsload.Append(@"function ChangeFormat()" + "\n" + "{" + "\n");
>
> jsload.Append("\t" + @"var
> sSelected2=document.getElementById(FontNameList);" + "\n");
>
> jsload.Append("\t" + @"var
> sSelected3=sSelected2.Options(sSelected2.selectedIndex);" + "\n");
>
> jsload.Append("\t" +
> @"document.execCommand('FontName',false,sSelected3.text);" + "\n");
>
> jsload.Append("}" + "\n");
>
> jsload.Append(@"function changeFontSize(strid)" + "\n" + "{" + "\n");
>
> jsload.Append("\t" + @"var sSelected1=document.getElementById(strid);" +
> "\n");
>
> jsload.Append("\t" + @"var
> sSelected=sSelected1.options(sSelected1.selectedIndex);" + "\n");
>
> jsload.Append("\t" +
> @"document.execCommand('FontSize',false,sSelected.value);" + "\n");
>
> jsload.Append(@"}" + "\n");
>
> jsload.Append(@"</script>" + "\n");
>
>
> string CMSUpReg=jsload.ToString();
>
> Page.RegisterClientScriptBlock("Startup",CMSUpReg);
>
> }
>
> }
>
> This is the where the object is rendered
>
> protected override void OnPreRender(EventArgs e)
>
> {
>
> base.OnPreRender (e);
>
> if(!Page.IsClientScriptBlockRegistered("jObject"))
>
> {
>
> StringBuilder jsObject=new StringBuilder();
>
> jsObject.Append(@"<Object id='dlgHelper'
> CLASSID='clsid:3050f819-98b5-11cf-bb82-00aa00bdce0b' Width='0'
> Height='0'></Object>" + "\n");
>
> string strjsObject=jsObject.ToString();
>
> Page.RegisterClientScriptBlock("jObject",strjsObject);
>
> }
>
> }
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
If 'undefined' then ... VS Try / Catch - how to trap 'undefined Rich Microsoft VB .NET 4 30th Sep 2008 05:33 PM
E-mail Undefined =?Utf-8?B?RGFuY2Vy?= Windows XP Help 1 16th Dec 2004 03:54 AM
Call to Undefined Dynalink Jon Horton horton.jon@ntlworld.com Windows XP Performance 1 30th Aug 2004 11:10 AM
webpage error: "undefined" is undefined line 470 marc.peng@scotiabank.com Windows XP Internet Explorer 0 2nd Mar 2004 10:20 PM
Undefined Dynalink Andrew Dean Windows XP Performance 0 4th Nov 2003 10:10 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:54 PM.