Groups | Blog | Home
all groups > dotnet jscript > june 2005 >

dotnet jscript : I'm so confuuuused.


Sam Samnah
6/29/2005 4:04:41 PM
I get the folling error message:

"Microsoft JScript runtime error:'null' is null or not an object"

the error is referring to the following script:

"function moveCurser(divMenu, hidMenu)
{

var i;

var j;

i=document.getElementById(divMenu);

j=document.getElementById(hidMenu);

j.value=i.innerHTML;

alert(j);

}"

this function is called on the following statement:

"<input name="FreeForm1:_ctl4" id="FreeForm1__ctl4" type="hidden" /><div
CONTENTEDITABLE="true" width="100%" height="100%"
onfocusout="moveCurser(oDiv,FreeForm1__ctl4)" id="oDiv"></div>"

Any help with this is much appreciated. I don't know what is wrong with
this script.

Thank you in advance-

Anyhow for further understanding of whats going on here below is the markup
for the entire page:

"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >

<HTML>

<HEAD>

<title>Testing</title>

<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">

<meta content="C#" name="CODE_LANGUAGE">

<meta content="JavaScript" name="vs_defaultClientScript">

<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">

<LINK href="http://localhost/RainbowCentre1/CSSScript/Rainbowcss.css"
type="text/css"

rel="stylesheet">

</HEAD>

<body MS_POSITIONING="GridLayout">

<form name="Form1" method="post" action="Testing.aspx" id="Form1">

<input type="hidden" name="__VIEWSTATE"
value="dDw4NTY2MjIyMzg7dDw7bDxpPDE+Oz47bDx0PDtsPGk8MT47PjtsPHQ8O2w8aTwzPjs+O2w8dDw7bDxpPDE+Oz47bDx0PDtsPGk8MT47PjtsPHQ8dDw7aTwwPjtpPC0xPj47Oz47Pj47Pj47Pj47Pj47Pj47PjhxeeTad9uYg+9YCHZJQoV0B3zl"
/>

<script language='javascript' type='text/javascript'>

function moveCurser(divMenu, hidMenu)

{

var i;

var j;

i=document.getElementById(divMenu);

j=document.getElementById(hidMenu);

j.value=i.innerHTML;

alert(j);

}

</script>



<script language='javascript' type='text/javascript'>

window.onload=doInit;

function doInit()

{

for(i=0;i<document.all.length;i++)

document.all(i).unselectable = 'on';

oDiv.unselectable = 'off';

oDiv.innerHTML='';

oDiv.focus();

}

function callFormating(sformatString)

{

document.execCommand(sformatString);

}

function ChangeFormat(strid)

{

var sSelected2=document.getElementById(strid);

var sSelected3=sSelected2.options(sSelected2.selectedIndex);

document.execCommand('FontName',false,sSelected3.text);

}

function changeFontSize(strid)

{

var sSelected1=document.getElementById(strid);

var sSelected=sSelected1.options(sSelected1.selectedIndex);

document.execCommand('FontSize',false,sSelected.value);

}

</script>





<table id="FreeForm1"
style="background-color:#C0C0FF;border-color:Navy;border-width:1px;border-style:Solid;height:100%;width:100%;">


<tr height="1">


<td>

<img Src="http://localhost/RainbowCentre1/Images/Bold.gif"
Onclick="callFormating('bold')" />

<img Src="http://localhost/RainbowCentre1/Images/italic.gif"
Onclick="callFormating('italic')" />

</td>


</tr>

<tr height="1">


<td>

<select id="FreeForm1:_ctl3:_ctl0" name="FreeForm1:_ctl3:_ctl0">

</select>

</td>


</tr>

<tr bgcolor='#ffffff' height='100%' width='100%'><td valign='top'><input
name="FreeForm1:_ctl4" id="FreeForm1__ctl4" type="hidden" /><div
CONTENTEDITABLE="true" width="100%" height="100%"
onfocusout="moveCurser(oDiv,FreeForm1__ctl4)" id="oDiv"></div></td></tr>

</table>

<input type="submit" name="ButtonClick" value="Submit" id="ButtonClick" />

<span id="FieldTest"></span>

</form>

</body>

</HTML>"

Yunus Emre ALPÖZEN [MCSD.NET]
7/1/2005 11:15:59 PM
Either try to call your function like

onfocusout="moveCurser('oDiv','FreeForm1__ctl4')"

or try to modify your function like

function moveCurser(divMenu, hidMenu)
{
hidMenu.value=divMenu.innerHTML;
}

you call your function with objects but you try to process them as object
names...

HTH
--

Thanks,
Yunus Emre ALPÖZEN
BSc, MCSD.NET

[quoted text, click to view]

AddThis Social Bookmark Button