Passing values from dropdown

V

vincent.s.jones

I keep getting this error message with my Javascript posted below.
The values are all nvarchar, with my database.

Thanks,

var curr_date = document.formevents.select.Dy.value;
var curr_month = document.formevents.select.Mh.value;
var curr_year = document.formevents.select.Yr.value;

function showEvents(v)
{
xmlHttp=GetXmlHttpObject()
if(xmlHttp==null)
{
alert("Browser does not support HHTP Request")
return
}

if(v=="t")
{
var url="cftime.cfm?Mh="+curr_month+"&Dy="+curr_date
+"&Yr="+curr_year;
}
if(v=="c")
{
var url="cfcompany.cfm?Mh="+curr_month+"&Dy="+curr_date
+"&Yr="+curr_year;
}
if(v=="l")
{
var url="cflocation.cfm?Mh="+curr_month+"&Dy="+curr_date
+"&Yr="+curr_year;
}


xmlHttp.onreadystatechange=eventsChanged;
xmlHttp.open("GET", url, true)
xmlHttp.send(null)

}

function eventsChanged()
{
if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
document.getElementById
("event_body").innerHTML=xmlHttp.responseText;
}
}
 
D

David Mark

I keep getting this error message with my Javascript posted below.

What error message and in what browser?
The values are all nvarchar, with my database.

Thanks,

var curr_date = document.formevents.select.Dy.value;
var curr_month = document.formevents.select.Mh.value;
var curr_year = document.formevents.select.Yr.value;

These are what you refer to as "nvarchar?"

And don't use shortcuts like that. Use the standard forms, elements
and options collections, as implemented by documents, forms and
selects respectively.
function showEvents(v)
{
        xmlHttp=GetXmlHttpObject()

(assuming this oddly named function returns an XHR object.)
        if(xmlHttp==null)
                {
                        alert("Browser does not support HHTP Request")

Never tell the user that their browser does not support a made-up
protocol. And use window.alert.
                        return
                }

                if(v=="t")
                        {
                                var url="cftime.cfm?Mh="+curr_month+"&Dy="+curr_date
+"&Yr="+curr_year;
                        }
                if(v=="c")
                        {
                                var url="cfcompany.cfm?Mh="+curr_month+"&Dy="+curr_date
+"&Yr="+curr_year;
                        }
                if(v=="l")
                        {
                                var url="cflocation.cfm?Mh="+curr_month+"&Dy="+curr_date
+"&Yr="+curr_year;
                        }

                xmlHttp.onreadystatechange=eventsChanged;
                xmlHttp.open("GET", url, true)


                xmlHttp.send(null)

}

function eventsChanged()
{
                if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
                {
                                document.getElementById
("event_body").innerHTML=xmlHttp.responseText;

Always test the gEBI result before use. Maybe that is your error.
Hard to say.

[snip]
 

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,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top