Jump to content

kwilliams

Members
  • Content Count

    229
  • Joined

  • Last visited

Everything posted by kwilliams

  1. I'm trying to pull a server-side variable (VB) into client-side code (JavaScript). I can do this successfully using a regular ASP.NET page, but when I try to implement the same thing using the MasterPage method, I receive an error. I've included the working and non-working code below, along with the results of each. If anyone can please let me know what I'm doing wrong, that would be greatly appreciated. Thanks.SAMPLE #1: WORKING CODE (SINGLE ASP.NET PAGE) <%@ Page Language="VB" Explicit="True" %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><script runat="server"> 'Like MasterPage.master.vb Dim CurrentState As String = "Colorado"</script><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Current State</title><script language="JavaScript"><!-- //Like MasterPage.js var currentState = "<% Response.Write(CurrentState) %>";// --></script></head><script language="JavaScript"> //Like MasterPage.master document.write(currentState);</script></body></html> SAMPLE #1 RESULT: (works properly)ColoradoSAMPLE #2 NON-WORKING ASP.NET MASTERPAGE:MasterPage.master.vb Partial Class MasterPage Inherits System.Web.UI.MasterPage Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Dim CurrentState As String = "Colorado" End SubEnd Class MasterPage.master <%@ Master Language="VB" CodeFile="MasterPageAlerts.master.vb" Inherits="MasterPageAlerts" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Untitled Page</title> <script language="JavaScript"> <!-- //Like MasterPage.js var currentState = "<% Response.Write(CurrentState) %>"; // --> </script></head><body> <form id="form1" runat="server"> <div> <script language="JavaScript"> //Like MasterPage.master document.write(currentState);</script> <asp:contentplaceholder id="ContentPlaceHolder1" runat="server"> </asp:contentplaceholder> </div> </form></body></html> SAMPLE #2 RESULT: (error)Compiler Error Message: BC30451: Name 'CurrentState' is not declared.Line 9: <!--Line 10: //Like MasterPage.jsLine 11: var currentState = "<% Response.Write(CurrentState) %>";<<<------THIS IS THE ERRORLine 12: // -->Line 13: </script>
  2. Hello Jesh,I apologize about that, but that was just a typo. It really reads:alert_nodelist = alert_xmld.SelectNodes("/alerts/alert")alert_status = alert_xmld.SelectNodes("/alerts/alert/alertstatus")alert_state = alert_xmld.SelectNodes("/alerts/alert/alertstate") I had to change some of the node names for the post, and I forgot to change those ones. Anyway, I think that my problem lies in the call of the node. Here's what I've tried so far:Using this: strAlertStatus = alert_node.Attributes.GetNamedItem("status").Value strAlertState = alert_node.Attributes.GetNamedItem("state").Value results in the following error for the "strAlertStatus" node:Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.Using this: strAlertStatus = alert_status.Attributes.GetNamedItem("status").Value strAlertState = alert_state.Attributes.GetNamedItem("state").Value results in the following error for the "strAlertStatus" node: Compiler Error Message: BC30456: 'Attributes' is not a member of 'System.Xml.XmlNodeList'.And using this: strAlertStatus = aa_node.SelectSingleNode("//alertstatus/@status").Value strAlertState = aa_node.SelectSingleNode("//alertstate/@state").Value Results in the first nodeset being looped three times, which is the number of nodesets in the XML doc, like this:*Page Properties*strAlertStatus: closedstrAlertState: CO*Page Properties*strAlertStatus: closedstrAlertState: CO*Page Properties*strAlertStatus: closedstrAlertState: COI guess this could be progress, but I obviously don't know why it's not looping properly. So as you can see, I'm pretty lost on where to go from here. I'm trying really hard to solve this on my own, but I REALLY need some help on this one. Any other suggestions would be greatly appreciated. Thanks.
  3. Well, I figured out how to loop this XML document until a condition is reached:XML: <alerts> <alert issued="01/02/2008" updated="01/02/2008 7:00 AM"> <alertstatus status="closed"></alertstatus> <alertstate state="CO"></alertstate> </alert> <alert issued="01/02/2008" updated="01/02/2008 8:00 AM"> <alertstatus status="open"></alertstatus> <alertstate state="IA"></alertstate> </alert> <alert issued="01/02/2008" updated="01/02/2008 9:00 AM"> <alertstatus status="closed"></alertstatus> <alertstate state="KS"></alertstate> </alert></alerts> ASP.NET: Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Dim objNodeExists As Object = False 'Check for active alert Dim alert_xmld As XmlDocument Dim alert_nodelist As XmlNodeList Dim alert_status As XmlNodeList, alert_state As XmlNodeList Dim strAlertStatus As String, strAlertState As String Dim alert_node As XmlElement Dim objShowAlert As Object = False 'Create the XML Document alert_xmld = New XmlDocument() 'Load the Xml file alert_xmld.Load("alerts.xml") 'Get the list of name nodes alert_nodelist = alert_xmld.SelectNodes("/alerts/alert") alert_status = alert_xmld.SelectNodes("/alerts/alert/status") alert_state = alert_xmld.SelectNodes("/alerts/alert/state") Dim intCounter As Integer = 0 Dim strAlertIssued As String, strAlertUpdated As String If objShowAlert = False Then For Each alert_node In alert_nodelist intCounter = intCounter + 1 If strAlertIssued = "01/02/2008" AND intCounter <= 10 Then 'Assign object if node is not empty objNodeExists = True 'Get an Attribute Value strAlertIssued = alert_node.Attributes.GetNamedItem("issued").Value strAlertUpdated = alert_node.Attributes.GetNamedItem("updated").Value If strAlertIssued = "01/02/2008" Then objShowAlert = True End If Response.Write("<strong>*Page Properties*</strong><br />" & _ "strAlertIssued: " & strAlertIssued & "<br />" & _ "strAlertUpdated: " & strAlertUpdated & "<br /><br />") End If Next 'end loop End If 'Alert show/hide If objShowAlert = True Then Response.Write("<h1>SHOW ALERTS</h1>") End IfEnd Sub RESULT:*Page Properties*strAlertIssued: 01/01/2008strAlertUpdated: 01/01/2008 7:00 AM*Page Properties*strAlertIssued: 01/01/2008strAlertUpdated: 01/01/2008 8:00 AM*Page Properties*strAlertIssued: 01/01/2008strAlertUpdated: 01/01/2008 9:00 AMThis works great if I'm just trying to pull the attributes ("issued" and "updated") from the "alert" node, but it doesn't work when I try to pull values from child nodes of the "alert" node (@status from alertstatus node and @state from alertstate node). I've tried messing around with different methods (i.e. GetElementsByTagName, SelectSingleNode, etc.), but I'm a newbie to this, and I'm not sure how to accomplish what I need using these methods.If anyone can please help me to figure out what I'm doing wrong, I'd really appreciate it. Thanks again.
  4. I have an ASP.NET page w/ VB syntax that loops through an XML document's nodes, and returns values from the selected node's attribute (status).Now in addition to the "status" attribute located in the "alertstatus" node, I need to pull the "state" attribute from the "alertstate" node that's located within the main element titled "<alert>". But I'm not sure how to do this. I've included the code that I have so far below. If anyone can clue me in on how I can accomplish this, that would be great. Thanks for any and all help.XML DOC (alerts.xml): <alerts> <alert issued="01/12/2008" updated="01/12/2008 7:00 AM"> <alertstatus status="closed"></alertstatus> <alertstate state="CO"></alertstate> </alert> <alert issued="01/13/2008" updated="01/13/2008 8:00 AM"> <alertstatus status="open"></alertstatus> <alertstate state="IA"></alertstate> </alert> <alert issued="01/14/2008" updated="01/14/2008 9:00 AM"> <alertstatus status="closed"></alertstatus> <alertstate state="KS"></alertstate> </alert></alerts> ASP.NET DOC: Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Dim objNodeExists As Object = False 'Check for active alert Dim alert_xmld As XmlDocument Dim alert_nodelist As XmlNodeList Dim alert_status As XmlNodeList, alert_state As XmlNodeList Dim strAlertStatus As String, strAlertState As String Dim alert_node As XmlElement Dim objShowAlert As Object = False 'Create the XML Document alert_xmld = New XmlDocument() 'Load the Xml file alert_xmld.Load("http://www.mysite.com/docs/xml/alerts.xml") 'obviously this is not a real live document:) 'Get the list of name nodes alert_nodelist = alert_xmld.SelectNodes("/alerts/alert/alertstatus") For Each alert_node In alert_nodelist If objShowAlert = False Then 'Assign object if node is not empty objNodeExists = True 'Get an Attribute Value strAlertStatus = alert_node.Attributes.GetNamedItem("status").Value If strAlertStatus = "open" Then objShowAlert = True End If 'Write TEXT results to the page - TEST Response.Write("<strong>*Page Properties*</strong><br />" & _ "strAlertStatus: " & strAlertStatus & "<br />" & _ "objShowAlert: " & objShowAlert & "<br /><br />") End If Next 'end loop 'Alert show/hide If objShowAlert = True Then Response.Write("<h1>SHOW ALERT</h1>") End If End Sub RESULT:*Page Properties*strAlertStatus: openobjShowAlert: True<h1>SHOW ALERT</h1>WANTED RESULT:*Page Properties*strAlertStatus: openstrAlertState: IA <<----THIS IS WHAT I NEEDobjShowAlert: True<h1>SHOW ALERT</h1>
  5. Here's a working solution that I received from another forum: <div id="content"> <asp:literal runat="server" id="litScrollerJS"> <!-- Scroller --> <div class="scroller"> <script type="text/javascript"> new pausescroller(pausecontent, "scroller", "someclass", 8000) </script> </div><!-- end scroller --> </asp:literal></div><!-- end content --><script runat="server"> Partial Class MasterPage Inherits System.Web.UI.MasterPage Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) 'Scroller TEST litScrollerJS.Visible = False End Sub End Class</script> Thanks for your help anyway. I really appreciate it.
  6. That was just a typo, but thanks for the heads-up. Hopefully someone can help me out:)
  7. Thanks to a great site, I have the following code that produces a news scroller: <%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" Title="Test Page" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Test Page</title><script type="text/javascript"> var pausecontent=new Array() var strAlert1 = "This is alert #1."; var strAlert2 = "This is alert #2."; var strAlert3 = "This is alert #3."; pausecontent[0]='<strong><a href="alert1.aspx">Alert #1:</a></strong> ' + strAlert1 pausecontent[1]='<strong><a href="alert2.aspx">Alert #2:</a></strong> ' + strAlert2 pausecontent[2]='<strong><a href="alert3.aspx">Alert #3:</a></strong> ' + strAlert3 /*********************************************** * Pausing up-down scroller- © Dynamic Drive (www.dynamicdrive.com) * This notice MUST stay intact for legal use * Visit http://www.dynamicdrive.com/ for this script and 100s more. ***********************************************/ function pausescroller(content, divId, divClass, delay){ this.content=content //message array content this.tickerid=divId //ID of ticker div to display information this.delay=delay //Delay between msg change, in miliseconds. this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over scroller (and pause it if it is) this.hiddendivpointer=1 //index of message array for hidden div document.write('<div id="'+divId+'" class="'+divClass+'" style="position: relative; overflow: hidden"><div class="innerDiv" style="position: absolute; width: 100%" id="'+divId+'1">'+content[0]+'</div><div class="innerDiv" style="position: absolute; width: 100%; visibility: hidden" id="'+divId+'2">'+content[1]+'</div></div>') var scrollerinstance=this if (window.addEventListener) //run onload in DOM2 browsers window.addEventListener("load", function(){scrollerinstance.initialize()}, false) else if (window.attachEvent) //run onload in IE5.5+ window.attachEvent("onload", function(){scrollerinstance.initialize()}) else if (document.getElementById) //if legacy DOM browsers, just start scroller after 0.5 sec setTimeout(function(){scrollerinstance.initialize()}, 500) } // ------------------------------------------------------------------- // initialize()- Initialize scroller method. // -Get div objects, set initial positions, start up down animation // ------------------------------------------------------------------- pausescroller.prototype.initialize=function(){ this.tickerdiv=document.getElementById(this.tickerid) this.visiblediv=document.getElementById(this.tickerid+"1") this.hiddendiv=document.getElementById(this.tickerid+"2") this.visibledivtop=parseInt(pausescroller.getCSSpadding(this.tickerdiv)) //set width of inner DIVs to outer DIV's width minus padding (padding assumed to be top padding x 2) this.visiblediv.style.width=this.hiddendiv.style.width=this.tickerdiv.offsetWidth-(this.visibledivtop*2)+"px" this.getinline(this.visiblediv, this.hiddendiv) this.hiddendiv.style.visibility="visible" var scrollerinstance=this document.getElementById(this.tickerid).onmouseover=function(){scrollerinstance.mouseoverBol=1} document.getElementById(this.tickerid).onmouseout=function(){scrollerinstance.mouseoverBol=0} if (window.attachEvent) //Clean up loose references in IE window.attachEvent("onunload", function(){scrollerinstance.tickerdiv.onmouseover=scrollerinstance.tickerdiv.onmouseout=null}) setTimeout(function(){scrollerinstance.animateup()}, this.delay) } // ------------------------------------------------------------------- // animateup()- Move the two inner divs of the scroller up and in sync // ------------------------------------------------------------------- pausescroller.prototype.animateup=function(){ var scrollerinstance=this if (parseInt(this.hiddendiv.style.top)>(this.visibledivtop+5)){ this.visiblediv.style.top=parseInt(this.visiblediv.style.top)-5+"px" this.hiddendiv.style.top=parseInt(this.hiddendiv.style.top)-5+"px" setTimeout(function(){scrollerinstance.animateup()}, 50) } else{ this.getinline(this.hiddendiv, this.visiblediv) this.swapdivs() setTimeout(function(){scrollerinstance.setmessage()}, this.delay) } } // ------------------------------------------------------------------- // swapdivs()- Swap between which is the visible and which is the hidden div // ------------------------------------------------------------------- pausescroller.prototype.swapdivs=function(){ var tempcontainer=this.visiblediv this.visiblediv=this.hiddendiv this.hiddendiv=tempcontainer } pausescroller.prototype.getinline=function(div1, div2){ div1.style.top=this.visibledivtop+"px" div2.style.top=Math.max(div1.parentNode.offsetHeight, div1.offsetHeight)+"px" } // ------------------------------------------------------------------- // setmessage()- Populate the hidden div with the next message before it's visible // ------------------------------------------------------------------- pausescroller.prototype.setmessage=function(){ var scrollerinstance=this if (this.mouseoverBol==1) //if mouse is currently over scoller, do nothing (pause it) setTimeout(function(){scrollerinstance.setmessage()}, 100) else{ var i=this.hiddendivpointer var ceiling=this.content.length this.hiddendivpointer=(i+1>ceiling-1)? 0 : i+1 this.hiddendiv.innerHTML=this.content[this.hiddendivpointer] this.animateup() } } pausescroller.getCSSpadding=function(tickerobj){ //get CSS padding value, if any if (tickerobj.currentStyle) return tickerobj.currentStyle["paddingTop"] else if (window.getComputedStyle) //if DOM2 return window.getComputedStyle(tickerobj, "").getPropertyValue("padding-top") else return 0 }</script></head><body><div> <script type="text/javascript"> new pausescroller(pausecontent, "scroller", "someclass", 4000); </script> </div></body></html> But I need to use this code within an ASP.NET/VB page using proper methods. This is what I've come up with so far: <%@ Master Language="VB" CodeFile="MasterPage.master.vb" Inherits="MasterPage" Debug="True" %><%@ Import Namespace="System" %><%@ Import Namespace="System.IO" %><%@ Import Namespace="System.Xml" %><%@ Import Namespace="System.Xml.XPath" %><%@ Import Namespace="System.Xml.Xsl" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><script runat="server"> Partial Class MasterPage Inherits System.Web.UI.MasterPage Sub Page_PreLoad(ByVal sender As Object, ByVal e As EventArgs) 'Scroller TEST Dim objScroller As Object = False End SubEnd Class</script><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head id="Head1" runat="server"> <title>Test Page</title> <%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" Title="Test Page" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Test Page</title><script language="javascript" type="text/javascript" var pausecontent=new Array() var strAlert1 = "This is alert #1."; var strAlert2 = "This is alert #2."; var strAlert3 = "This is alert #3."; pausecontent[0]='<strong><a href="alert1.aspx">Alert #1:</a></strong> ' + strAlert1 pausecontent[1]='<strong><a href="alert2.aspx">Alert #2:</a></strong> ' + strAlert2 pausecontent[2]='<strong><a href="alert3.aspx">Alert #3:</a></strong> ' + strAlert3 /*********************************************** * Pausing up-down scroller- © Dynamic Drive (www.dynamicdrive.com) * This notice MUST stay intact for legal use * Visit http://www.dynamicdrive.com/ for this script and 100s more. ***********************************************/ function pausescroller(content, divId, divClass, delay){ this.content=content //message array content this.tickerid=divId //ID of ticker div to display information this.delay=delay //Delay between msg change, in miliseconds. this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over scroller (and pause it if it is) this.hiddendivpointer=1 //index of message array for hidden div document.write('<div id="'+divId+'" class="'+divClass+'" style="position: relative; overflow: hidden"><div class="innerDiv" style="position: absolute; width: 100%" id="'+divId+'1">'+content[0]+'</div><div class="innerDiv" style="position: absolute; width: 100%; visibility: hidden" id="'+divId+'2">'+content[1]+'</div></div>') var scrollerinstance=this if (window.addEventListener) //run onload in DOM2 browsers window.addEventListener("load", function(){scrollerinstance.initialize()}, false) else if (window.attachEvent) //run onload in IE5.5+ window.attachEvent("onload", function(){scrollerinstance.initialize()}) else if (document.getElementById) //if legacy DOM browsers, just start scroller after 0.5 sec setTimeout(function(){scrollerinstance.initialize()}, 500) } // ------------------------------------------------------------------- // initialize()- Initialize scroller method. // -Get div objects, set initial positions, start up down animation // ------------------------------------------------------------------- pausescroller.prototype.initialize=function(){ this.tickerdiv=document.getElementById(this.tickerid) this.visiblediv=document.getElementById(this.tickerid+"1") this.hiddendiv=document.getElementById(this.tickerid+"2") this.visibledivtop=parseInt(pausescroller.getCSSpadding(this.tickerdiv)) //set width of inner DIVs to outer DIV's width minus padding (padding assumed to be top padding x 2) this.visiblediv.style.width=this.hiddendiv.style.width=this.tickerdiv.offsetWidth-(this.visibledivtop*2)+"px" this.getinline(this.visiblediv, this.hiddendiv) this.hiddendiv.style.visibility="visible" var scrollerinstance=this document.getElementById(this.tickerid).onmouseover=function(){scrollerinstance.mouseoverBol=1} document.getElementById(this.tickerid).onmouseout=function(){scrollerinstance.mouseoverBol=0} if (window.attachEvent) //Clean up loose references in IE window.attachEvent("onunload", function(){scrollerinstance.tickerdiv.onmouseover=scrollerinstance.tickerdiv.onmouseout=null}) setTimeout(function(){scrollerinstance.animateup()}, this.delay) } // ------------------------------------------------------------------- // animateup()- Move the two inner divs of the scroller up and in sync // ------------------------------------------------------------------- pausescroller.prototype.animateup=function(){ var scrollerinstance=this if (parseInt(this.hiddendiv.style.top)>(this.visibledivtop+5)){ this.visiblediv.style.top=parseInt(this.visiblediv.style.top)-5+"px" this.hiddendiv.style.top=parseInt(this.hiddendiv.style.top)-5+"px" setTimeout(function(){scrollerinstance.animateup()}, 50) } else{ this.getinline(this.hiddendiv, this.visiblediv) this.swapdivs() setTimeout(function(){scrollerinstance.setmessage()}, this.delay) } } // ------------------------------------------------------------------- // swapdivs()- Swap between which is the visible and which is the hidden div // ------------------------------------------------------------------- pausescroller.prototype.swapdivs=function(){ var tempcontainer=this.visiblediv this.visiblediv=this.hiddendiv this.hiddendiv=tempcontainer } pausescroller.prototype.getinline=function(div1, div2){ div1.style.top=this.visibledivtop+"px" div2.style.top=Math.max(div1.parentNode.offsetHeight, div1.offsetHeight)+"px" } // ------------------------------------------------------------------- // setmessage()- Populate the hidden div with the next message before it's visible // ------------------------------------------------------------------- pausescroller.prototype.setmessage=function(){ var scrollerinstance=this if (this.mouseoverBol==1) //if mouse is currently over scoller, do nothing (pause it) setTimeout(function(){scrollerinstance.setmessage()}, 100) else{ var i=this.hiddendivpointer var ceiling=this.content.length this.hiddendivpointer=(i+1>ceiling-1)? 0 : i+1 this.hiddendiv.innerHTML=this.content[this.hiddendivpointer] this.animateup() } } pausescroller.getCSSpadding=function(tickerobj){ //get CSS padding value, if any if (tickerobj.currentStyle) return tickerobj.currentStyle["paddingTop"] else if (window.getComputedStyle) //if DOM2 return window.getComputedStyle(tickerobj, "").getPropertyValue("padding-top") else return 0 }</script></head><body><div> <script type="text/javascript"> new pausescroller(pausecontent, "scroller", "someclass", 4000); </script> </div></body></html></head><body> <div id="content"> <% If objScroller = True Then %> <!-- ***THIS SHOULD RESULT IN THE SCROLLER NOT SHOWING UP*** --> <!-- Scroller --> <div class="scroller"> <script type="text/javascript"> new pausescroller(pausecontent, "scroller", "someclass", 8000) </script> </div><!-- end scroller --> <% End If %> </div><!-- end content --></body></html> ...but this results in a "Name 'objScroller' is not declared." error message.So I really need some help at figuring out how to use the JavaScript within an ASP.NET/VB page in the proper way. Any and all help is appreciated. Thanks.
  8. Now I've run into another issue, and hopefully you or someone can help:I want to display the scroller only if the "//Alertstatus/@status" node = "open", and the "//Alertinfo/@states" node = "CO". So first, I created a copy of the XML feed on another domain to test this out (xmlfeedcopy.xml). Next, I'm trying to create a JavaScript loop for the external XML feed, but I'm only getting the first element's values. Here's what I have so far:XML Doc (sample copy of external feed - not real data):<?xml version="1.0" encoding="ISO-8859-1"?><AmberAlerts> <AmberAlert issued="11/05/07" updated="11/06/07 7:45 AM" sourceurl="http://codeamber.org/mendozamn/" issued_gmt="11/06/07" updated_gmt="11/06/07 13:45 GMT"> <Alertstatus status="closed"> The Minnesota Crime Alert Network and the St. Paul Police Department canceled the Amber Alert Tuesday morning after the girl was found safe and a suspect taken into custody. </Alertstatus> <FullText> The Minnesota Crime Alert Network and the St. Paul Police Department canceled the Amber Alert Tuesday morning after the girl was found safe and a suspect taken into custody. The Minnesota Crime Alert Network and the St. Paul Police Department had issued the Amber Alert Monday evening after the girl was assaulted and forced into the suspect vehicle. Jacqueline Mendoza, 15, a 5-foot tall Hispanic female, 110 pounds, brown eyes, long black hair and a scar below her left eye. She was wearing last seen wearing a brown sweater, yellow Capri pants and black tennis shoes. The suspects are David Guzman, an 18 year old Hispanic male, 5'10 with black hair and brown eyes weighing 180 pounds. He wqs last seen wearing a dark blue nylon "Los Angeles" jacket with white lettering, checkered light blue shirt. Police say the suspect has a history of handguns and long guns. A second suspect is an unknown Hispanic female approximately 30 years old, 5' 11", brown eyes and black hair with a heavy build.. She was last seen wearing gray sweat pants and black "Los Angeles" jacket with white lettering. The suspect vehicle is a 1990's light blue 4-door Chevy with Minnesota tag MTH 303 or 303 MTH. Anyone with information is asked to call Jim Gray at the Bureau of Criminal Apprehension at 651-266-3659 or 651-291-1111 or dial 911. </FullText> <Alertinfo date="Monday November 5" location="St. Paul MN US" zip="551" fullzip="55101" states="MN" Addstates="" counties="" date_gmt="Tuesday November 6"> </Alertinfo> <Victims> <Victim race="Hispanic" gender="female" age="15 yrs." height="5'" weight="110" hair="black" eyes="brown" name="Jacqueline Mendoza"> She was wearing last seen wearing a brown sweater, yellow Capri pants and black tennis shoes. <Picture>"</Picture> <Picturelarge orientation=""></Picturelarge> </Victim> </Victims> </AmberAlert> <!-- ***THIS IS THE ONE THAT I WANT PULLED*** --> <AmberAlert issued="12/19/07" updated="12/19/07 7:45 AM" sourceurl="http://codeamber.org/kwilliams/" issued_gmt="12/19/07" updated_gmt="12/19/07 13:45 GMT"> <Alertstatus status="open"> The Colorado Crime Alert Network and the Elizabeth Police Department have issued an amber alert for... </Alertstatus> <FullText> The Colorado Crime Alert Network and the Elizabeth Police Department have issued an amber alert for... </FullText> <Alertinfo date="Wednesday December 19" location="Elizabeth CO US" zip="801" fullzip="80107" states="CO" Addstates="" counties="" date_gmt="Wednesday December 19"> </Alertinfo> <Victims> <Victim race="Black" gender="female" age="32 yrs." height="5'1" weight="115" hair="brown" eyes="brown" name="K. Williams"> She was wearing last seen wearing a black sweater, gray pants and black boots. <Picture>"</Picture> <Picturelarge orientation=""></Picturelarge> </Victim> </Victims> </AmberAlert></AmberAlerts> ASP Doc (JavaScript): <%@ LANGUAGE="JAVASCRIPT" %><% var xmlDoc; xmlDoc = new ActiveXObject("Msxml2.DOMDocument.3.0") xmlDoc.async=false; xmlDoc.setProperty("ServerHTTPRequest", true) //Load check //if (xmlDoc.load("http://codeamber.org/a1xl04act/amberalert.xml") == false) {//then LIVE VERSION if (xmlDoc.load("http://www.anotherdomain.com/docs/xml/xmlfeedcopy.xml") == false) {//then TEST VERSION Response.Write("Failed to load xml"); } //end if //***LOOP NEEDS TO GO HERE*** //***THIS IS WHAT I HAVE THAT'S ONLY PULLING THE FIRST XML ELEMENT var x = xmlDoc.getElementsByTagName("AmberAlert"); for (i=0;i<x.length;i++) { //Declare variables var strAlertStatus_node = xmlDoc.selectSingleNode("//Alertstatus/@status").text; var strAlertState_node = xmlDoc.selectSingleNode("//Alertinfo/@states").text; }//end loop //THIS IS ANOTHER POSSIBLE OPTION, BUT I'M NOT SURE HOW TO USE IT PROPERLY WITH AN XML DOCUMENT //var x = xmlDoc.getElementsByTagName("AmberAlert"); //var myArray = new Array(x); //for (i=0;i<myArray.length;i++) {//begin loop //Response.Write(myArray[i]); //}//end loop if (strAlertStatus_node == "open" && strAlertState_node == "CO") {//then var objScrollerStatus = true }//end if if (objScrollerStatus == true) {//then //Display results of loop Response.Write("strAlertStatus_node: " + strAlertStatus_node + "<br />"); Response.Write("strAlertState_node: " + strAlertState_node + "<br />"); Response.Write("objScrollerStatus: " + objScrollerStatus + "<br />"); }//end if%> WANTED HTML OUTPUT:strAlertStatus_node: openstrAlertState_node: COobjScrollerStatus: trueI know that I'm a bit lost, but I can't find much documentation on how to accomplish this. Any and all help would be appreciated. Thanks.
  9. It worked great! Thanks for your help justsomeguy....I really appreciate it. This forum rocks.
  10. That's what I thought, but I didn't think it would hurt to ask.I did your suggestion, like this:<script type="text/javascript"> var strAlertStatus = <%=(strYada)%> document.write("strAlertStatus: " + strAlertStatus); </script>When I view it in the browser, nothing is displayed. But when I view the source code, this is the result:<script type="text/javascript"> var strAlertStatus = The State of New Mexico canceled the Amber Alert after the child was found safe on Sunday afternoon. The suspect remains at large at this time. document.write("strAlertStatus: " + strAlertStatus); </script>So I'm not sure if the variable would be usable in the client-side JS, but if I add double-quotes around the variable's value, it might work. Is there an easy way to add those double-quotes to this variable's value? I thought it was <%=(""" + strYada + """)%>, but that just resulted in: var strAlertStatus = """ + The State of..." in the source code. Any ideas would be great. Thanks.
  11. Well, this is gone in a different direction thanks to aalbetski's help, and now I have another question:The code in this thread works great at pulling nodes from an external XML feed. I have an internal client-side "news scroller" script (JavaScript) that I want to display some of the nodes from the server-side code.So can I pull XML nodes from an external XML feed, declare variables from that code, and then use those server-side variables within client-side code?Something like this: <%@ LANGUAGE="JAVASCRIPT" %><% var xmlDoc; xmlDoc = new ActiveXObject("Msxml2.DOMDocument.3.0") xmlDoc.async=false; xmlDoc.setProperty("ServerHTTPRequest", true) <!-- You need this for both to get a remote XML feed this way --> if (xmlDoc.load("http://codeamber.org/a1xl04act/amberalert.xml") == false) { Response.Write("Failed to load xml"); }var amberDescription = xmlDoc.selectSingleNode("//FullText").text;//<<----CAN I PULL THIS INTO CLIENT-SIDE CODE???%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head> <title>Pull XML Feed</title><script type="text/javascript" language="javascript">var pausecontent=new Array()//These need to be dynamically pulled from existing XML feeds:pausecontent[0]='<strong><a href="amberalert.aspx">Amber Alert:</a></strong> ' + amberDescription + ' <a href="amberdetails.aspx">Learn more >></a>'pausecontent[1]='<strong><a href="anotherfeed.aspx">Another Feed:</a></strong> ' + anotherfeedDescription + ' <a href="anotherfeed.aspx">Learn more >></a>'//.....MORE JS CODE GOES HERE TO CREATE THE ACTUAL SCROLLER...}</script></head><body> <h1>Pull XML Feed</h1> <p><b>Alertstatus:</b> <span id="Alertstatus"><%=xmlDoc.selectSingleNode("//Alertstatus").text %></span><br /> <b>FullText:</b> <span id="FullText"><%=xmlDoc.selectSingleNode("//FullText").text %></span><br /> <b>Alertinfo:</b> <span id="Alertinfo"></span><br /> <b>AlertState:</b> <span id="AlertState"><%=xmlDoc.selectSingleNode("//Alertinfo/@states").text %></span><br /> <b>Victim:</b> <span id="Victim"><%=xmlDoc.selectSingleNode("//Victim/@name").text %></span> </p> <script type="text/javascript"> new pausescroller(pausecontent, "scroller", "someclass", 8000) </script></body></html> I don't know much about using client-side code in conjunction with server-side code, so if anyone can let me know if this is possible, that would be great. Thanks.
  12. I added your referenced line of code to my code, but it's still not working. I noticed that you mentioned server-side code, so I'm assuming that's probably why. Using the example from http://www.w3schools.com/dom/dom_examples.asp and your referenced line of code, I created the following code that works great on a local XML doc, but not on a remote XML feed. Here is my complete code:<%@LANGUAGE="JAVASCRIPT"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>XML Feed Test</title> <script language="javascript"> var xmlDoc; function loadXML() { //load xml file // code for IE if (window.ActiveXObject) { xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.setProperty("ServerHTTPRequest", true) <!-- You need this to get a remote XML feed --> xmlDoc.async=false; xmlDoc.load("http://codeamber.org/a1xl04act/amberalert.xml"); getmessage(); } // code for Mozilla, Firefox, Opera, etc. else if (document.implementation && document.implementation.createDocument) { xmlDoc=document.implementation.createDocument("","",null); xmlDoc.load("http://codeamber.org/a1xl04act/amberalert.xml"); xmlDoc.onload=getmessage; } else { alert('Your browser cannot handle this script'); } } function getmessage() { document.getElementById("Alertstatus").innerHTML=xmlDoc.getElementsByTagName("Alertstatus")[0].childNodes[0].nodeValue; document.getElementById("FullText").innerHTML=xmlDoc.getElementsByTagName("FullText")[0].childNodes[0].nodeValue; document.getElementById("Alertinfo").innerHTML=xmlDoc.getElementsByTagName("Alertinfo")[0].childNodes[0].nodeValue; document.getElementById("AlertState").innerHTML=Alertinfo.getElementsByTagName("states")[0].childNodes[0].nodeValue; document.getElementById("Victim").innerHTML=xmlDoc.getElementsByTagName("Victim")[0].childNodes[0].nodeValue; } </script></head><body onload="loadXML()"><h1>Pull XML Feed</h1><p><b>Alertstatus:</b> <span id="Alertstatus"></span><br /><b>FullText:</b> <span id="FullText"></span><br /><b>Alertinfo:</b> <span id="Alertinfo"></span><br /><b>AlertState:</b> <span id="AlertState"></span><br /><b>Victim:</b> <span id="Victim"></span></p></body></html> Did I place that line of code in the correct place? If not, where should it be placed?This code needs to be client-side, as I need to use the results in another client-side script. I found a quick article on parsing XML w/JavaScript at http://www.captain.at/howto-ajax-xml-javascript.php, and it works great when using the example XML string. But how can I use this code with an external XML file instead of a string? Thanks for any help.
  13. I copied and pasted the code from this article, but nothing happened. Is there some simple example code that shows how this can work? I like this code, as it has a crossbrowser example. It works great at loading an internal XML doc, but it doesn't work on an external XML doc. Is there a way to make this code work with an external XML feed?
  14. All the feeds I'm using are XML feeds vs. RSS feeds, and I'm also wanting to use some internal XML docs for those feeds. I tried to find a way to parse an XML doc client-side, but I can't find any source code. I can only find server-side solutions. Do you have any suggestions of where I could find them?
  15. I'm trying to convert code that was originally client-side into server-side code. It pulls data from several XML feeds, and then uses variables from that data in a news scroller. When client-side with static variables, the data scrolls every 5 seconds. But the server-side example doesn't scroll at all.Almost everything works fine, except for the setTimeout. When I load the code listed below, I receive this error:Microsoft JScript runtime error '800a1391''window' is undefined/scroller.asp, line 173I realize that 'window' is a browser object that cannot be used in server-side code, but I'm not sure how to adjust my code to make it work. If anyone could let me know what I'm doing wrong, that would be great. Thanks. <%var pausecontent=new Array() var strMessage1 = "This is message 1"; var strMessage2 = "This is message 2"; var strMessage3 = "This is message 3"; pausecontent[0]='<strong>Title 1: ' + strMessage1 + '</strong>' pausecontent[1]='<strong>Title 2: ' + strMessage2 + '</strong>' pausecontent[2]='<strong>Title 3: ' + strMessage3 + '</strong>' /*********************************************** * Pausing up-down scroller- © Dynamic Drive (www.dynamicdrive.com) * This notice MUST stay intact for legal use * Visit http://www.dynamicdrive.com/ for this script and 100s more. ***********************************************/ function pausescroller(content, divId, divClass, delay){ this.content=content //message array content this.tickerid=divId //ID of ticker div to display information this.delay=delay //Delay between msg change, in miliseconds. this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over scroller (and pause it if it is) this.hiddendivpointer=1 //index of message array for hidden div Response.Write('<div id="'+divId+'" class="'+divClass+'" style="position: relative; overflow: hidden"><div class="innerDiv" style="position: absolute; width: 100%" id="'+divId+'1">'+content[0]+'</div><div class="innerDiv" style="position: absolute; width: 100%; visibility: hidden" id="'+divId+'2">'+content[1]+'</div></div>') var scrollerinstance=this //*****************THIS IS WHERE I'M HAVING THE PROBLEM**************************** if (window.addEventListener) //run onload in DOM2 browsers window.addEventListener("load", function(){scrollerinstance.initialize()}, false) else if (window.attachEvent) //run onload in IE5.5+ window.attachEvent("onload", function(){scrollerinstance.initialize()}) else if (document.getElementById) //if legacy DOM browsers, just start scroller after 0.5 sec setTimeout(function(){scrollerinstance.initialize()}, 500) } // ------------------------------------------------------------------- // initialize()- Initialize scroller method. // -Get div objects, set initial positions, start up down animation // ------------------------------------------------------------------- pausescroller.prototype.initialize=function(){ this.tickerdiv=document.getElementById(this.tickerid) this.visiblediv=document.getElementById(this.tickerid+"1") this.hiddendiv=document.getElementById(this.tickerid+"2") this.visibledivtop=parseInt(pausescroller.getCSSpadding(this.tickerdiv)) //set width of inner DIVs to outer DIV's width minus padding (padding assumed to be top padding x 2) this.visiblediv.style.width=this.hiddendiv.style.width=this.tickerdiv.offsetWidth-(this.visibledivtop*2)+"px" this.getinline(this.visiblediv, this.hiddendiv) this.hiddendiv.style.visibility="visible" var scrollerinstance=this document.getElementById(this.tickerid).onmouseover=function(){scrollerinstance.mouseoverBol=1} document.getElementById(this.tickerid).onmouseout=function(){scrollerinstance.mouseoverBol=0} if (window.attachEvent) //Clean up loose references in IE window.attachEvent("onunload", function(){scrollerinstance.tickerdiv.onmouseover=scrollerinstance.tickerdiv.onmouseout=null}) setTimeout(function(){scrollerinstance.animateup()}, this.delay) } // ------------------------------------------------------------------- // animateup()- Move the two inner divs of the scroller up and in sync // ------------------------------------------------------------------- pausescroller.prototype.animateup=function(){ var scrollerinstance=this if (parseInt(this.hiddendiv.style.top)>(this.visibledivtop+5)){ this.visiblediv.style.top=parseInt(this.visiblediv.style.top)-5+"px" this.hiddendiv.style.top=parseInt(this.hiddendiv.style.top)-5+"px" setTimeout(function(){scrollerinstance.animateup()}, 50) } else{ this.getinline(this.hiddendiv, this.visiblediv) this.swapdivs() setTimeout(function(){scrollerinstance.setmessage()}, this.delay) } } // ------------------------------------------------------------------- // swapdivs()- Swap between which is the visible and which is the hidden div // ------------------------------------------------------------------- pausescroller.prototype.swapdivs=function(){ var tempcontainer=this.visiblediv this.visiblediv=this.hiddendiv this.hiddendiv=tempcontainer } pausescroller.prototype.getinline=function(div1, div2){ div1.style.top=this.visibledivtop+"px" div2.style.top=Math.max(div1.parentNode.offsetHeight, div1.offsetHeight)+"px" } // ------------------------------------------------------------------- // setmessage()- Populate the hidden div with the next message before it's visible // ------------------------------------------------------------------- pausescroller.prototype.setmessage=function(){ var scrollerinstance=this if (this.mouseoverBol==1) //if mouse is currently over scoller, do nothing (pause it) setTimeout(function(){scrollerinstance.setmessage()}, 100) else{ var i=this.hiddendivpointer var ceiling=this.content.length this.hiddendivpointer=(i+1>ceiling-1)? 0 : i+1 this.hiddendiv.innerHTML=this.content[this.hiddendivpointer] this.animateup() } } pausescroller.getCSSpadding=function(tickerobj){ //get CSS padding value, if any if (tickerobj.currentStyle) return tickerobj.currentStyle["paddingTop"] else if (window.getComputedStyle) //if DOM2 return window.getComputedStyle(tickerobj, "").getPropertyValue("padding-top") else return 0 }%>
  16. Our old site used ASP, and our new site uses ASP.NET to display XML data using an XSLT transformation. I've just set up a custom 404 page for the new site. If I enter a test URL to test the redirect, this is how it works:1) If I enter http://www.mysite.com/http404.aspx, the custom 404 page loads properly.2) If I enter http://www.mysite.com/yadayada.aspx, which doesn't exist, I get redirected to the custom 404 page.3) If I enter http://www.mysite.com/yadayada.asp, which doesn't exist, I do not get redirected to the custom 404 page. Instead, I get an error message:XML Parsing Error: not well-formedLocation: http://www.mysite.com/yadayada.aspLine Number 1, Column 2:<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" EnableSessionState="false" EnableViewState="false" title="HTTP 404" %>-^I checked to make sure that all of the documents are well-formed, so I'm not sure why this is happening. If anyone could let me know what is causing this, I'd really appreciate it. Thanks.
  17. kwilliams

    CSS & Form Fields

    Hallelujah! I've found an answer by looking at one of the sources of my CSS menu...suckerfish. And it works great.Here's an article on how to do exactly what I needed: http://tanny.ica.com/ICA/TKO/tkoblog.nsf/d...p-in-ie-part-ii...and here's an example page that they created to show how it works: http://tanny.ica.com/ICA/TKO/test.nsf/####.../examplefix.htm This solution uses the iframe method mentioned previously in this post, while allowing only part of the select menu to be hidden. Hopefully this will help other developers in the future. Thanks for all of your help.
  18. Well, after some additional scripting, I've come up with a workaround. It pulls the seconds from the user's clock, and then redirects them in 5-10 seconds, depending if they have IE or FF. Here's the code, in-case anyone's interested: <%@LANGUAGE="JAVASCRIPT" %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><%Response.Buffer = true;//Declare variablesvar strOldURL = "oldpage.asp";var strNewURL = "newpage.aspx"%><html><head><title>Auto-Redirect</title><%var todaysDate = new Date();//current datevar oldSeconds = todaysDate.getSeconds();//current secondsvar refreshURL = strOldURL + "?counter=" + oldSeconds;//querystring%><meta http-equiv="refresh" content="5;URL=<%=(refreshURL)%>" /><%var counterCheck = Request.QueryString("counter");var counterCheckAdd = parseInt(counterCheck);//convert string to integerif (oldSeconds == (counterCheckAdd + 5)) {//then Response.Status = "301 Moved Permanently";//Update search engines Response.AddHeader("Location", strNewURL);//Redirect user to new URL}//end if%></head><body><h2>The Page Has Moved</h2>The page you are looking for has moved.<br /><br /><strong>Old Location: </strong><%=(strOldURL)%><br /><strong>New Location: </strong><a href="<%=(strNewURL)%>"><%=(strNewURL)%></a><br /><br />You will be automatically redirected to the new page in just a moment. Please update your bookmarks and/or links.</body></html> It can take 5-10 seconds, bit it works well for me, so that's a good thing. Thanks so much for your help.
  19. I changed "REFRESH" to "Refresh", but it had no affect. And Unfortunately I can't use the meta tag refresh method instead of this method, because my goal is to first inform the search engines that the link has changed before redirecting the user.Before trying a lot of workarounds, I messed around with the original code a bit to see where the problem lies. And when I comment out the 'Response.Status = "301 Moved Permanently";' line, the page redirects after 5 seconds in all browsers just fine. So I've been researching the "301 Moved Permanently" HTTP status code everywhere, and it appears that I've written it correctly. So I'm completely lost as to why this isn't working along with the 'Response.Status = "301 Moved Permanently";' status code. Any suggestions would be great. Thanks.
  20. I have an old ASP site, and I've created a new ASP.NET site. I'm trying to set up an auto-redirect on each of the old ASP pages that will:1) Tell the search engines that the URL has permanently moved2) Redirect the user to the new URL after a 5 second delay, so that they can see a note about the changeI've found a few articles on how to properly do this at:http://blogs.msdn.com/samar/archive/2005/06/07/425963.aspxhttp://www.webdeveloper.com/forum/archive/...hp/t-11443.htmlhttp://forums.aspfree.com/asp-development-...ect-141800.htmlAnd this is what I've come up with: <%@LANGUAGE="JAVASCRIPT" %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><%Response.Buffer = true;//Declare variablesvar strOldURL = "oldpage.asp";var strNewURL = "newpage.aspx"//Update search enginesResponse.Status = "301 Permanently Moved";//Redirect to new page in 5 seconds//Response.AddHeader("REFRESH", "5;URL=" + strNewURL);//NOT WORKING IN IE - LIVE%><html><head></head><body><h2>The Page Cannot Be Found</h2><br />The page you are looking for has moved.<br /><br /><strong>Old Location: </strong><%=(strOldURL)%><br /><strong>New Location: </strong><a href="<%=(strNewURL)%>"><%=(strNewURL)%></a><br /><br />You will be redirected to the new page in 5 seconds. Please correct any broken bookmarks.</body></html> This solution works fine in Firefox, but not in IE6 or IE7 (The page cannot be displayed). One of the articles noted that the "Response.AddHeader" is controlled by the browser, so it won't alway work. But I don't know of another way to create a delay within an ASP page using JavaScript syntax. Also, I've seen "301 Moved Permanently" and "301 Permanently Moved" used in several examples, but I don't see which of these is proper...or will they both work fine? If anyone can let me know what I'm doing wrong, that would be great. Thanks.
  21. Will do. Thanks again!P.S. For any users that view this thread in the future, here is a download of the XML parser (MSXML 4.0 Service Pack 2) mentioned by aalbetski: http://www.microsoft.com/downloads/details...;displaylang=en
  22. Ok, that makes perfect sense. I have some knowledge in everything, but I'll perpetually be a newbie I think.Anyway, I copied and pasted your code into my editor and gave it a look. It came across great in IE6, IE7 and FF, but I received the following error message when I tried to replace 'xmlDoc = new ActiveXObject("Microsoft.XMLDOM")' with 'xmlDoc = new ActiveXObject("Msxml2.DOMDocument.4.0")' per your suggestion:Microsoft JScript runtime error '800a01ad'Automation server can't create object/pullxmlfeed.asp, line 14 So I changed 'new ActiveXObject("Msxml2.DOMDocument.4.0")' to 'new ActiveXObject(MSXML2.DOMDocument.3.0")', and it worked great in all 3 browsers (YEAH). Thanks for your help...I REALLY appreciate it. Thank GOD for this forum:)
  23. I'm just learning how to parse an XML feed with JavaScript, but I'm having some problems. If I copy and paste the code from the XML feed into an internal file, and I reference that file in my code, it works fine. But when I try to change the XML source doc to the XML feed's URL (http://codeamber.org/a1xl04act/amberalert.xml), nothing shows up. Obviously there's something that I'm missing when it comes to parsing an internal XML doc vs. an XML feed. In addition to pulling in the main elements, I'm trying to pull the attributes of some elements without success. So if anyone could let me know what I'm missing and/or doing wrong, it would be greatly appreciated. I've included my code below: <%@LANGUAGE="JAVASCRIPT" %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><title>Pull XML Feed</title><script type="text/javascript">var xmlDoc;function loadXML(){//load xml file// code for IEif (window.ActiveXObject){ xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async=false; xmlDoc.load("pullxmlfeed.xml");//I want this to pull from external XML feed at http://codeamber.org/a1xl04act/amberalert.xml getmessage();}// code for Mozilla, Firefox, Opera, etc.else if (document.implementation && document.implementation.createDocument){ xmlDoc=document.implementation.createDocument("","",null); xmlDoc.load("pullxmlfeed.xml");//I want this to pull from external XML feed at http://codeamber.org/a1xl04act/amberalert.xml xmlDoc.onload=getmessage;}else{ alert('Your browser cannot handle this script');}}function getmessage(){document.getElementById("Alertstatus").innerHTML=xmlDoc.getElementsByTagName("Alertstatus")[0].childNodes[0].nodeValue;document.getElementById("FullText").innerHTML=xmlDoc.getElementsByTagName("FullText")[0].childNodes[0].nodeValue;document.getElementById("Alertinfo").innerHTML=xmlDoc.getElementsByTagName("Alertinfo")[0].childNodes[0].nodeValue;document.getElementById("AlertState").innerHTML=Alertinfo.getElementsByTagName("states")[0].childNodes[0].nodeValue;//I want to pull attribute 'status' from 'Alertinfo' nodedocument.getElementById("Victim").innerHTML=xmlDoc.getElementsByTagName("Victim")[0].childNodes[0].nodeValue;}</script></head><body onload="loadXML()"><h1>Pull XML Feed</h1><p><b>Alertstatus:</b> <span id="Alertstatus"></span><br /><b>FullText:</b> <span id="FullText"></span><br /><b>Alertinfo:</b> <span id="Alertinfo"></span><br /><b>AlertState:</b> <span id="AlertState"></span><br /><b>Victim:</b> <span id="Victim"></span></p></body></html>
  24. Ahah. I figured it out. I was using this hollow square: □, when I should have been using this hollow square: . Pretty strange.Anyway, they are actually being stored in the DB table with the actual square, not the code for the square. The form that allows this data is a rich text edit form, which allows users to submit data from Word. That's where this crap data is entering from. If you or anyone could give me some suggestions of a good RTE, that would be great. In the meantime, I'll just implement this SP to remove those characters until I do get another front-end solution. Thanks for your help.
  25. Thanks for the suggested code...I'll work on adding that today, and I'll let you know when/if I'm successful.I agree that it would be a good idea to make it available for multiple options, as I'm also trying to remove a hollow square from the table. But I'm not having success with that at all, as the SP is saying that there are no records with the '□' character. But when I view the data through an ASPX front-end page, the hollow square still shows up. I've tried using '□' and '□' within the SP without success. If you have any information on the hollow square character within SQL Server, please let me know, as I'm truly stumped on that one.But at least the arrow can be removed without a problem:)
×
×
  • Create New...