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)

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"&gt;

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?

Comments

This discussion has been closed.
Meet your Ambassadors

🚀 Getting Started

Hi new member!

Our Getting Started Guide will help you get the most out of the Forum

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.4K Travel & Transport
  • 1.5M Hobbies & Leisure
  • 16K Discuss & Feedback
  • 37.7K Read-Only Boards

Is this how you want to be seen?

We see you are using a default avatar. It takes only a few seconds to pick a picture.