We’d like to remind Forumites to please avoid political debate on the Forum.
This is to keep it a safe and useful space for MoneySaving discussions. Threads that are – or become – political in nature may be removed in line with the Forum’s rules. Thank you for your understanding.
📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!
Easy techie question...not (HTML/ASP/JS)
wheredmymoneygo
Posts: 86 Forumite
in Techie Stuff
I have an ASP page with 2 dropdown list boxes. They have id's of "select2" and "select3". Their "onchange" event is set to call a javascript function that will draw a button on screen (as follows):
function checkDeferDate()
{
var el1 = document.getElementById('select2');
var el2 = document.getElementById('select3');
var myDate = el1.options[el1.selectedIndex].value;
var myMonth = el2.options[el2.selectedIndex].value;
(rest of code removed)
}
This code works fine, everything happens as it should.
I have a requirement to add the line:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
This has now broken the Javascript function if the ASP page is accessed from any other PC (it still works on the webserver).
I have tried wrapping the javascript in CDATA tags, and moving it to the end of the <body> section.
It fails with the error "object required" on the line:
var myDate = el1.options[el1.selectedIndex].value;
Any ideas?
function checkDeferDate()
{
var el1 = document.getElementById('select2');
var el2 = document.getElementById('select3');
var myDate = el1.options[el1.selectedIndex].value;
var myMonth = el2.options[el2.selectedIndex].value;
(rest of code removed)
}
This code works fine, everything happens as it should.
I have a requirement to add the line:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
This has now broken the Javascript function if the ASP page is accessed from any other PC (it still works on the webserver).
I have tried wrapping the javascript in CDATA tags, and moving it to the end of the <body> section.
It fails with the error "object required" on the line:
var myDate = el1.options[el1.selectedIndex].value;
Any ideas?
0
Comments
-
wheredmymoneygo wrote: »I have a requirement to add the line:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
Are you declaring the document to be Transitional or Strict? Your DOCTYPE is informing us that it is Transitional but then you are pointing to the Strict DTD.
Try changing...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
...to...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
... or if it really is meant to be strict (which is why I think it breaks the code)...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
You can find more information here http://www.w3.org/QA/2002/04/valid-dtd-list.html0
This discussion has been closed.
Confirm your email address to Create Threads and Reply
Categories
- All Categories
- 352.4K Banking & Borrowing
- 253.7K Reduce Debt & Boost Income
- 454.4K Spending & Discounts
- 245.5K Work, Benefits & Business
- 601.3K Mortgages, Homes & Bills
- 177.6K Life & Family
- 259.3K Travel & Transport
- 1.5M Hobbies & Leisure
- 16K Discuss & Feedback
- 37.7K Read-Only Boards