How to enable imagebutton from another frame

R

Rod

Hi!
I have 2 frames called "Left" and "Main".
In the "main" I have this imagebutton (the enabled property is set to
"False"):

<form id="Form1" method="post" runat="server">
<asp:imagebutton id="ImgBtProdotti" runat="server"
imageurl="/image.jpg"></asp:imagebutton>
</form>

In the frame "Left" I have a butto and on the "click" event I want to
"enable" the "ImgBtProdotti".
I wrote :

s = "<script language='javascript'>" & vbCrLf & "<!--" & vbCrLf &
"window.parent.frames['Main'].document.all('ImgBtProdotti').enabled = True;"
& vbCrLf & "//-->" & vbCrLf & "</script>"
Response.Write(s)

But It doesn't work. The error is : True is not defined.



Could anyone help me ?
 
M

Marius Tennes Krogh

Rod said:
Hi!
I have 2 frames called "Left" and "Main".
In the "main" I have this imagebutton (the enabled property is set to
"False"):

<form id="Form1" method="post" runat="server">
<asp:imagebutton id="ImgBtProdotti" runat="server"
imageurl="/image.jpg"></asp:imagebutton>
</form>

In the frame "Left" I have a butto and on the "click" event I want to
"enable" the "ImgBtProdotti".
I wrote :

s = "<script language='javascript'>" & vbCrLf & "<!--" & vbCrLf &
"window.parent.frames['Main'].document.all('ImgBtProdotti').enabled =
True;"
& vbCrLf & "//-->" & vbCrLf & "</script>"
Response.Write(s)

But It doesn't work. The error is : True is not defined.



Could anyone help me ?

I think HTML elements have a "disabled" property and not a "enabled"
property. And javascript is also case sensitive. So try to write this
instead:
window.parent.frames['Main'].document.all('ImgBtProdotti').disabled = false

See this link for reference:
http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/disabled_2.asp

And you should use "document.getElementById(.....)" instead of
"document.all(....)"

Marius
 
R

Rod

Thanks.
Using "....disabled" all it's all right.

A question: what is the difference using "...document.getelementbyid('...')
or ...document.all('..) ?



Marius Tennes Krogh said:
Rod said:
Hi!
I have 2 frames called "Left" and "Main".
In the "main" I have this imagebutton (the enabled property is set to
"False"):

<form id="Form1" method="post" runat="server">
<asp:imagebutton id="ImgBtProdotti" runat="server"
imageurl="/image.jpg"></asp:imagebutton>
</form>

In the frame "Left" I have a butto and on the "click" event I want to
"enable" the "ImgBtProdotti".
I wrote :

s = "<script language='javascript'>" & vbCrLf & "<!--" & vbCrLf &
"window.parent.frames['Main'].document.all('ImgBtProdotti').enabled =
True;"
& vbCrLf & "//-->" & vbCrLf & "</script>"
Response.Write(s)

But It doesn't work. The error is : True is not defined.



Could anyone help me ?

I think HTML elements have a "disabled" property and not a "enabled"
property. And javascript is also case sensitive. So try to write this
instead:
window.parent.frames['Main'].document.all('ImgBtProdotti').disabled =
false

See this link for reference:
http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/disabled_2.asp

And you should use "document.getElementById(.....)" instead of
"document.all(....)"

Marius
 
M

Marius Tennes Krogh

"document.all(...)" is not specified in W3C's DOM (Document Object Model),
where as "document.getElementById(...)" is. In other words -
"document.getElementById(...)" is standard, "document.all(...)" is not.

http://www.quirksmode.org/js/dom.html
http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-html.html#ID-36113835

Marius


Rod said:
Thanks.
Using "....disabled" all it's all right.

A question: what is the difference using
"...document.getelementbyid('...') or ...document.all('..) ?



Marius Tennes Krogh said:
Rod said:
Hi!
I have 2 frames called "Left" and "Main".
In the "main" I have this imagebutton (the enabled property is set to
"False"):

<form id="Form1" method="post" runat="server">
<asp:imagebutton id="ImgBtProdotti" runat="server"
imageurl="/image.jpg"></asp:imagebutton>
</form>

In the frame "Left" I have a butto and on the "click" event I want to
"enable" the "ImgBtProdotti".
I wrote :

s = "<script language='javascript'>" & vbCrLf & "<!--" & vbCrLf &
"window.parent.frames['Main'].document.all('ImgBtProdotti').enabled =
True;"
& vbCrLf & "//-->" & vbCrLf & "</script>"
Response.Write(s)

But It doesn't work. The error is : True is not defined.



Could anyone help me ?

I think HTML elements have a "disabled" property and not a "enabled"
property. And javascript is also case sensitive. So try to write this
instead:
window.parent.frames['Main'].document.all('ImgBtProdotti').disabled =
false

See this link for reference:
http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/disabled_2.asp

And you should use "document.getElementById(.....)" instead of
"document.all(....)"

Marius
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top