Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 19th, 2004, 01:52 PM
Friend of Wrox
 
Join Date: Apr 2004
Posts: 121
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Here is the select code...nothing spectacular...

<select name="opt3308" id="opt3308">
<option value="Y">Yes
<option value="N">No
</select>

Quote:
quote:Originally posted by Snib
 Strange.... in the past I've found a few reasons for this:

1) your browser doesn't support getElementById()
2) getElementById() is called before the element is loaded
3) typo

Can I see the code of your <select> menu? There may be a typo or something there. The code you posted looks fine.

HTH,

Snib

<><
Clay Hess
 
Old May 19th, 2004, 01:52 PM
Friend of Wrox
 
Join Date: Apr 2004
Posts: 121
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Forgot to mention...I am using IE6

Quote:
quote:Originally posted by fs22
 Here is the select code...nothing spectacular...

<select name="opt3308" id="opt3308">
<option value="Y">Yes
<option value="N">No
</select>

Quote:
quote:Originally posted by Snib
 Strange.... in the past I've found a few reasons for this:

1) your browser doesn't support getElementById()
2) getElementById() is called before the element is loaded
3) typo

Can I see the code of your <select> menu? There may be a typo or something there. The code you posted looks fine.

HTH,

Snib

<><
Clay Hess
Clay Hess
 
Old May 19th, 2004, 02:03 PM
Friend of Wrox
 
Join Date: Apr 2004
Posts: 121
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Snib,

I think I know why it is not working. The onLoad is firing before the elementID is rendered. I placed the code you suggested in the head. Where would you suggest I place it?

Clay Hess
 
Old May 19th, 2004, 03:09 PM
Friend of Wrox
 
Join Date: Apr 2004
Posts: 121
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Snib,

I moved the code out of the head and after the select box was rendered and it worked but I received a script error. Here is the error...

An error has occurred in the script on this page.

Line:295
Char:1
Error:Not Implemented
Code:0
URL: file:...yada yada (It is a local page)

Then I can choose to continue running scripts.

Whatcha think?

Quote:
quote:Originally posted by Snib
 Strange.... in the past I've found a few reasons for this:

1) your browser doesn't support getElementById()
2) getElementById() is called before the element is loaded
3) typo

Can I see the code of your <select> menu? There may be a typo or something there. The code you posted looks fine.

HTH,

Snib

<><
Clay Hess
 
Old May 19th, 2004, 03:28 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Not implemented...?

Don't have a clue. I'll let you know if I find something on it.

Snib

<><
 
Old May 19th, 2004, 03:40 PM
Friend of Wrox
 
Join Date: Apr 2004
Posts: 121
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Snib,

I got it to work by searching here and finding someone else who had the same problem. I changed the onload code as follows:

window.onload = function() {setChecked('opt3308');};

It works but I am not sure why. I always like the teach a man to fish method...so if you know why it works and what not implemented means, let me know. Thanks again for all your help. You are a lifesaver.

Quote:
quote:Originally posted by Snib
 Not implemented...?

Don't have a clue. I'll let you know if I find something on it.

Snib

<><
Clay Hess
 
Old May 19th, 2004, 04:11 PM
Friend of Wrox
 
Join Date: Apr 2004
Posts: 121
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Snib,

I was incorrect. So I spoke to soon. It is not fixed. It does not throw the error, but the code does not work either. SO whatever you can find out would be appreciated.

Quote:
quote:Originally posted by Snib
 Not implemented...?

Don't have a clue. I'll let you know if I find something on it.

Snib

<><
Clay Hess
 
Old July 16th, 2004, 04:39 AM
Registered User
 
Join Date: Jul 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

I know you wrote this a long time ago and have probably solved the problem but I was having the same problem myself. It is solved by changing onload to onLoad.

Cheers,

Alan





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to set a form as startup form in vb.net 2.0 mallikalapati .NET Framework 2.0 1 February 21st, 2008 09:19 AM
set password equal to variable fizzerchris SQL Server 2005 3 April 30th, 2007 01:45 AM
set form on subform gigi79 Access 2 May 23rd, 2006 03:08 PM
Set Focus on a Sub Form Brendan Bartley Access 5 September 9th, 2005 10:49 AM
How to "Set" a function equal to a DataReader DittoToo ASP.NET 1.0 and 1.1 Basics 1 July 1st, 2003 10:15 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.