473,324 Members | 2,511 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,324 software developers and data experts.

problem with onclick

I have a function in the head section of a html and call it from a radio
button with onClick="menu();" but IE tells me that the object doesnt support
this method or property. What is the problem with that? I have tried
numerous ways around it but to no avail.

<head>
function menu() {
for (i=0;i<=2;i++) {
if (document.menuform.menu[i].checked=="1") {
parent.main.location.href="document.menuform.menu[i].value + '.html'" }
}
}
</head>
<body>
<form name="menuform">
<radio name="form" value="news" onClick="menu();">
</body>

Thank you for your help,
-Dave
Jul 20 '05 #1
5 5720
Draken wrote on 02 jul 2003 in comp.lang.javascript:
I have a function in the head section of a html and call it from a
radio button with onClick="menu();" but IE tells me that the object
doesnt support this method or property. What is the problem with that?
I have tried numerous ways around it but to no avail.

<head>
function menu() {
for (i=0;i<=2;i++) {
if (document.menuform.menu[i].checked=="1") {
parent.main.location.href="document.menuform.menu[i].value + '.html'"
}
}
}
</head>
<body>
<form name="menuform">
<radio name="form" value="news" onClick="menu();">
</body>


No <script> tags
No closing </form>
<radio must be <input type="radio"
menuform.menu must be menuform.form, but
do not use as a name "form", it is reserved
..checked is boolean

======================

simplified, this works:

<script>
function menu() {
if (document.menuform.myform.checked)
alert(document.menuform.myform.value + '.html')
}
</script>

<body>
<form name="menuform">
<input type="radio" name="myform" value="news" onClick="menu();">
News
</form>
</body>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #2
Sorry, I was quickly writing some tags in as a reference that isnt the
actual code, so most of your points are already covered, and im guessing the
..checked should work both ways. See I have used my function as a
href="javascript: menu();" and it works exactly how I planned it to.
I just re-read that post and realised how many errors I made, pity my first
post didnt actually send as it was much more in depth and accurate *sigh*...
anyway, here is the exact code I have, sorry.

<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
function menu() {
for (i=0;i<=2;i++) {
if (document.menuform.menu[i].checked=="1") {
parent.main.location.href="document.menuform.menu[i].value + '.html'" }
}
}
//--!>
</SCRIPT>
</HEAD>
<BODY>
<FORM NAME="menuform">
<INPUT TYPE="RADIO" NAME="menu" VALUE="news" onClick=""><A HREF="javascript:
menu()" onMouseOver="document.menuform.menu[0].checked='1'">News</A><BR>
<INPUT TYPE="RADIO" NAME="menu" VALUE="new" onClick=""><A HREF="javascript:
menu()" onMouseOver="document.menuform.menu[1].checked='1'">new</A><BR>
</FORM>
</BODY>
</HTML>
Jul 20 '05 #3
I forgot I had taken the error out of my html file so the onClicks are empty
as you can see... however they WERE...
<INPUT TYPE="RADIO" NAME="menu" VALUE="news" onClick="menu();">

Hey its 3am, im allowed to make mistakes at this time of the morning *yawn*
stupid brain wake up!
Thanks
-Dave
Jul 20 '05 #4
Draken wrote on 02 jul 2003 in comp.lang.javascript:
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
function menu() {
for (i=0;i<=2;i++) {
if (document.menuform.menu[i].checked=="1") {
parent.main.location.href="document.menuform.menu[i].value + '.html'" }
}
}
//--!>
</SCRIPT>


Loose the "" around document.menuform.menu[i].value+'.html'
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
function menu() {
for (i=0;i<=2;i++) {
if (document.menuform.menu[i].checked=="1") {
parent.main.location.href=document.menuform.menu[i].value+'.html'}
}
}
</SCRIPT>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #5
> Loose the "" around document.menuform.menu[i].value+'.html'

Nope, that didnt fix it... the error is on line 27 which is the <INPUT
TYPE="RADIO"... line and says Object doesn't support this property or
method. I at first thought that meant the .value but as I said it works fine
in a href="javascript: menu();" call
Jul 20 '05 #6

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

Similar topics

8
by: Shock | last post by:
Hello everyone, I am having a problem with the program below. I have isolated the problem to the onclick event that is located throughout arrQuestions. The onclick event refers to a function...
1
by: Julius Mong | last post by:
Dear all, according to the ASV3 manual known problem section, to make an <a> execute some Javascript onclick: ...
2
by: orion30 | last post by:
Apparently, it's not possible to use the onClick event on a text, TR, TD elements using Firefox. I tried... Is-it true ? Is there an another solution ? Thank you
3
by: Robert Dell | last post by:
I have a problem comparing strings in an order form i'm writing. I want to give a running total at the bottom of the page and it appears to be working except it doesn't compare correctly (it...
11
by: Dagwood Bumstead | last post by:
I play around with js a little... I just don't get this. The file below is just trying out some things... it does exactly what I want (hides/displays some things, no big deal) The problem is...
18
by: len.hartley | last post by:
Hi, I am trying to pop-up a window when the user clicks on an image. The problem is that when the user clicks on the image and the window pops up OK, but the window underneath also proceeds to...
3
by: ilia | last post by:
Hi All, I am a newbie in terms of Javascript, I found some code on the net to swap rows in a table using innerHTML, this works fine in Firefox but IE is complaining, after some googling around I...
2
by: ars | last post by:
hi everyone i'm using some regular expression to paging, it work's fine in IE but not in Firefox i removed every thing to detect problem but i Can't , the only thing i got, is the innerHtml doent...
3
by: Michael_R_Banks | last post by:
I'm trying to dynamically build a table that allows users to remove rows when they click a corresponding button. For some reason, whenever I add the button to the table, it never fires the onclick...
2
by: swethak | last post by:
Hi, I am getting the problem the problem with google map in Internet Explorer. This map worked fine in mozilla . When i opened the same map in Internet Explorer i am getting the error...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.