Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 14 of 14
  1. #1
    New to the CF scene
    Join Date
    Jun 2013
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Drop-down seemingly invisible to form

    I have been asked to help out with code for our basketball web site.

    This uses a single, generic HTML page which gets INCLUDEd by the ASP page. It then calls a Sub in the ASP code called BuildPage which creates the HTML and then uses Response.Write to show the page. Now, there is a drop-down (d/d) which displays season names (e.g. "1994/1995", "1995/1996") so that different results or statistics can be displayed. This d/d is "sent" to a SPAN (using '.innerHTML') contained in the HTML file. This is so that all the ASP pages can display different text in a table header. The problem seems to be that, no matter what I try, the d/d - although visible on the rendered page - doesn't seem to exist as far as the form is concerned. When the 'onChange' event occurs, it calls code that reloads the ASP with the requested season number. However, on selecting a season, I get "Object required: 'document.getElementById(...)'" for the line containing the d/d name.

    A clue might be that the actual code appears on the page when viewed in 'View Source', although as I say, the d/d is rendered on the page OK.

    I read elsewhere that, owing to a quirk in IE, rather than use 'innerHTML' I need to use 'createElement' and 'setAttribute' etc. to build the d/d. I went through the pain of building that (that code writes a new 'SCRIPT' section and then calls the dynamically-created Sub) but the end result is exactly the same.

    I have attached what I hope are all the required files in 2 ZIPs (to bypass the 50K size restriction. The various flavours of the 'GetSeasonInfo' Sub in 'statistics.asp' will show you what I've tried.

    Lastly, can we P L E A S E avoid any comment about the use of tables, VBScript versus JavaScript, coding style and so on. I just want to get this done. We will think about a re-write when we have more time. Having said that, if anyone has reasonably easy-to-follow JS, I can probably use that or massage it into VBS (which is the original coder's preferred language).
    Attached Files Attached Files

  • #2
    New to the CF scene
    Join Date
    Jun 2013
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I should've included the fact that the d/d is dynamic because it's created from a database query.

  • #3
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,825
    Thanks
    78
    Thanked 4,413 Times in 4,378 Posts
    Ummm...and how are we supposed to actually test/debug this when we don't have your database?

    So you are saying that, when a season is selected in the <select> and the onchange is called, that's when you have the problem? And you are also saying that it seems that the problem is that the code triggered by the onchange can't "find" the <select>?

    So why not bypass the problem completely and just pass a *reference* to the <select> as part of the process.

    Example:
    Code:
    <SELECT ...
        onChange='vbscript: AdminFixtures_ChangePage( me, " & intPageToOpen & ")'" & vbCRLF
        ... >
    And then:
    Code:
    	Function AdminFixtures_ChangePage(select, intIndex)
    		Dim intSeasonIndex
    
    		'// Add 1 because index is zero-based
    		intSeasonIndex = select.SelectedIndex + 1
    
    		document.forms("frmAdminFixtures").action="../asp/AdminFixtures.asp?Page=" & intIndex & "&SeasonNo=" & intSeasonIndex
    		document.forms("frmAdminFixtures").submit()
    	End Function
    ************

    Or, for that matter, just pass the selectedIndex:
    Code:
    <SELECT ...
        onChange='vbscript: AdminFixtures_ChangePage( me.selectedIndex + 1, " & intPageToOpen & ")'" & vbCRLF
        ... >
    And then:
    Code:
    	Function AdminFixtures_ChangePage(intSeasonIndex, intIndex)
    		document.forms("frmAdminFixtures").action="../asp/AdminFixtures.asp?Page=" & intIndex & "&SeasonNo=" & intSeasonIndex
    		document.forms("frmAdminFixtures").submit()
    	End Function
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #4
    New to the CF scene
    Join Date
    Jun 2013
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you for your prompts response.

    I left out the d/b because it contains member's contact details, their passwords, etc. I figured that if someone wanted to run the actual code, it would be trivial to knock up an array of just 2 items and plug that in. If it would help, I can do that.

    I went with the last option, passing the season index. Now, though, it's as if the 'onChange' event isn't happening at all! The seelction changes, obviously, but no code executes. I've put a 'MsgBox intSeasonIndex' in there to see if maybe the index wasn't being passed but that doesn't get run. I've tried using 'Me.SelectedIndex + 1', 'lisSeason.SelectedIndex + 1', even 'document.forms("frmStatistics").lisSeason.SelectedIndex + 1'

  • #5
    New to the CF scene
    Join Date
    Jun 2013
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I actually prefer the way the code looks now (after the above changes) but I'm now thinking that there might be a way to write the script earlier, so that it gets written before the table. You can see I had an attempt before, using the 'spanDynamicCode' span in the generci HTML file. The problem I hit there was the d/d appeared in that span, rather than in the "header" and still failed with the original problem!

  • #6
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,825
    Thanks
    78
    Thanked 4,413 Times in 4,378 Posts
    Quote Originally Posted by VBScab View Post
    I went with the last option, passing the season index. Now, though, it's as if the 'onChange' event isn't happening at all! The seelction changes, obviously, but no code executes. I've put a 'MsgBox intSeasonIndex' in there to see if maybe the index wasn't being passed but that doesn't get run.
    Time to start debugging. Clearly there is a scripting error here.

    You can start by using something like:
    Code:
    <select ... onchange="vbscript: msgbox me.selectedIndex">
    To see if the vbscript is even being triggered. It may be that the browser doesn't like to see mixed vbscript and jscript in the same tag; I've never tried that. (Your onmouseover uses javascript, you might notice.)
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #7
    New to the CF scene
    Join Date
    Jun 2013
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    OK...we're a little way further forward...

    It seems that, no matter what I enter in this line:
    Code:
    strHTML = strHTML & "objElement.onchange=" & Chr(34) & "VBScript:MsgBox Me.SelectedIndex" & Chr(34) & vbCRLF
    it's ignored. What seems to be happening is that this line:
    Code:
    strHTML = strHTML & "objElement.attachEvent " & Chr(34) & "onchange" & Chr(34) & ", GetRef(" & Chr(34) & "Statistics_ChangePage" & Chr(34) & ")" & vbCRLF
    is the one being actioned. Then, on the client-side code, the content of the variable 'intSeasonIndex' is "[object]", a string or, more likely, an object which is coerced into a string by the runtime. From my reading, that's down to the use of GetRef which is the only way to dynamically get the Sub to run using VBScript.

    Next stage...research doing the same thing but in JavaScript :-(

    BTW, the JavaScript parts of the code (used for presenting tooltips) are commented-out for now but I can tell you that mixed VBS and JS work flawlessly elsewhere :-)

  • #8
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,825
    Thanks
    78
    Thanked 4,413 Times in 4,378 Posts
    No, this code will never work:
    Code:
    strHTML = strHTML & "objElement.onchange=" & Chr(34) & "VBScript:MsgBox Me.SelectedIndex" & Chr(34) & vbCRLF
    You can only use the Me like that if you code it inline, as in:
    Code:
    <select name="whatever" onchange="vbscript: MsgBox(Me.SelectedIndex)">
    If you want to do it by attaching an event handler, later, using [icode]oblElement.onchange[icode] you would use an anonymous function in JavaScript, but I'm not sure there is a way to use Me in that way in VBScript.

    But what I am mystified about: If you can't *FIND* the <select> then how are you managing to use objElement.onchange to attach the even to the un-findable <select>????

    If you can find it to do the attachment, why can't you use the same code during the event handling?

    EDIT: Never mind. I get it. objElement is happening as you are *CREATING* the <select>. DOH on me. Sorry.
    Last edited by Old Pedant; 06-06-2013 at 08:02 PM.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #9
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,825
    Thanks
    78
    Thanked 4,413 Times in 4,378 Posts
    Another way to do this:

    Add an ID to the <select>, in addition to the name.

    And then you can always find it using document.getElementById("...")

    ID's must be unique, of coruse, but I don't think that's a problem in this case, is it?
    Just give the <select> the same ID as its name: lisSeason

    So in place of
    Code:
    intSeasonIndex = document.forms("frmAdminFixtures").Elements("lisSeason").SelectedIndex + 1
    you would just do
    Code:
    intSeasonIndex =  document.getElementById("lisSeason").SelectedIndex + 1
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #10
    New to the CF scene
    Join Date
    Jun 2013
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Firstly, can I say that I *really* appreciate your help in this! :-)

    I switched to using JS for the dynamic part and that has removed the problem with just getting the "[object]" string. However, the problem then was that page would continually reload, because the 'onchange' event was being triggered by the adding of the drop-down's options. So now the code creates 2 separate scripts, both now in JS: one to create the d/d and on to attach the 'onchange' event to it. I have to use this route, apparently, because IE ignores changes to elements like d/d when they're created using the '.innerHTML' property and my testing early on with this page confirms that.

    So now the GetSeasonInfo sub looks like this:
    Code:
    	Sub yGetSeasonInfo()
    		Dim intRowCount
    		Dim intColumnCount
    		Dim strPageToOpen
    		Dim intPageToOpen
    
    		blnResult 			= OpenConnection(blnExclusive, True)
    
    		If Not blnResult Then
    			Exit Sub
    		End If
    
    		strPageToOpen 			= Request.QueryString("Page")
    		If Len(strPageToOpen) > 0 Then
    			intPageToOpen 		= CInt(strPageToOpen)
    		Else
    			intPageToOpen 		= 1
    		End If
    
    		strSQL 				= "SELECT * "
    		strSQL 				= strSQL & "FROM T_Season "
    
    		blnResult 			= OpenRecordset(strSQL)
    
    		If RS.BOF And RS.EOF Then
    			strMsg 			= "Unable to find any records, " & vbCRLF
    			strMsg 			= strMsg & strGoBackMsg
    			blnResult 		= ErrorHandler(strMsg, MB_ICONSTOP, "No Records Found Error")
    		Else
    			'// Given that page size, how many pages are there in the recordset?
    			intPageCount 		= RS.PageCount
    
    			If intPageToOpen < 1 Or intPageToOpen > intPageCount Then
    				'// Oops - bad page number, fix it
    				intPageToOpen 	= 1
    			End If
    
    			strToolTipText 		= "Select a season"
    			lngTipText		= Len(strToolTipText) * intTipTextMultiplier
    
    			intSeasonNo 		= 0
    
    			strSeasonSelected 	= Request.QueryString("SeasonNo")
    
    			'// Bit of a pig's ear, all this, but there's no other way!
    			strHTML = ""
    			strHTML = strHTML & "<SCRIPT type='text/vbscript'>" & vbCRLF
    
    			strHTML = strHTML & "	Sub Statistics_ChangePage(ByVal intSeasonIndex, ByVal intPageNumber)" & vbCRLF
    
    			strHTML = strHTML & vbCRLF
    			strHTML = strHTML & "		document.forms(" & Chr(34) & "frmStatistics" & Chr(34) & ").action=" & Chr(34) & "../asp/statistics.asp?Page=" & Chr(34) & " & intPageNumber & " & Chr(34) & "&SeasonNo=" & Chr(34) & " & intSeasonIndex" & vbCRLF
    			strHTML = strHTML & "		document.forms(" & Chr(34) & "frmStatistics" & Chr(34) & ").submit()" & vbCRLF
    			strHTML = strHTML & "	End Sub" & vbCRLF
    			strHTML = strHTML & "</SCRIPT>" & vbCRLF
    
    			strHTML = strHTML & "<SCRIPT type='text/javascript'>" & vbCRLF
    			strHTML = strHTML & "	function WriteSeasonCombo() {" & vbCRLF
    			strHTML = strHTML & "		var objElement;" & vbCRLF
    			strHTML = strHTML & "		var objOption;" & vbCRLF
    			strHTML = strHTML & vbCRLF
    			strHTML = strHTML & "		document.getElementById(" & Chr(34) & "spanHeaderExtension" & Chr(34) & ").innerHTML=" &Chr(34) & " for Season " & Chr(34) & ";" & vbCRLF
    			strHTML = strHTML & vbCRLF
    			strHTML = strHTML & "		objElement 	= document.createElement(" & Chr(34) & "SELECT" & Chr(34) & ");" & vbCRLF
    			strHTML = strHTML & "		objElement.setAttribute(" & Chr(34) & "NAME" & Chr(34) & "," & Chr(34) & "lisSeason" & Chr(34) & ");" & vbCRLF
    			strHTML = strHTML & "		objElement.setAttribute(" & Chr(34) & "ID" & Chr(34) & "," & Chr(34) & "lisSeason" & Chr(34) & ");" & vbCRLF
    			strHTML = strHTML & "		objElement.setAttribute(" & Chr(34) & "SIZE" & Chr(34) & "," & Chr(34) & "1" & Chr(34) & ");" & vbCRLF
    			strHTML = strHTML & "		objElement.setAttribute(" & Chr(34) & "STYLE" & Chr(34) & "," & Chr(34) & "WIDTH:" & intComboBoxWidth & Chr(34) & ");" & vbCRLF
    			strHTML = strHTML & vbCRLF
    
    '// Find a way to get these in, too
    'strHTML = strHTML & " onMouseOver=" & Chr(34) & "javascript:overlib('" & strToolTipText & "',ABOVE,WIDTH," & lngTipText &")" & Chr(34)
    'strHTML = strHTML & " onMouseOut=" & Chr(34) & "nd()" & Chr(34)
    
    			strHTML = strHTML & "		document.getElementById(" & Chr(34) & "spanHeaderExtension" & Chr(34) & ").appendChild(objElement)" & ";" & vbCRLF
    
    			'// Loop through records until it's the next page or the end of the recordset
    			Do While Not RS.EOF
    				With RS
    					intSeasonNo		= .Fields("SeasonNo")
    					strSeasonDescription	= .Fields("SeasonDescription")
    					'strSeasonStartDate	= .Fields("SeasonStartDate")
    					'strSeasonEndDate	= .Fields("SeasonEndDate")
    					blnIsCurrentSeason	= .Fields("CurrentSeason")
    				End With
    
    				strHTML = strHTML & "		objOption 	= document.createElement(" & Chr(34) & "option" & Chr(34) & ")" & ";" & vbCRLF
    
    				strHTML = strHTML & "		objOption.Value = " & Chr(34) & intSeasonNo & Chr(34) & ";" & vbCRLF
    				'strHTML = strHTML & "		objOption.innerHTML = " & Chr(34) & strSeasonDescription & Chr(34) & ";" & vbCRLF
    				strHTML = strHTML & "		objOption.appendChild(document.createTextNode(" & Chr(34) & strSeasonDescription & Chr(34) & "));" & vbCRLF
    
    				'// Only pre-select current season if no season was passed in
    				If Len(strSeasonSelected) = 0 Then
    					If blnIsCurrentSeason Then
    						Session("SeasonNo") = intSeasonNo
    						strHTML = strHTML & "			objOption.Selected = " & Chr(34) & "true" & Chr(34) & ";" & vbCRLF
    					End If
    				Else
    					If intSeasonNo = CInt(strSeasonSelected) Then
    						Session("SeasonNo") = CInt(strSeasonSelected)
    						strHTML = strHTML & "			objOption.Selected = " & Chr(34) & "true" & Chr(34) & ";" & vbCRLF
    
    						'// Re-use this variable for button text
    						strSeasonToShow = strSeasonDescription
    					End If
    				End If
    
    				strHTML = strHTML & "		objElement.appendChild(objOption);" & vbCRLF
    
    				strHTML = strHTML & vbCRLF
    
    				'// Move to the next record
    				RS.MoveNext
    			Loop
    
    			strHTML = strHTML & "	}" & vbCRLF
    			strHTML = strHTML & vbCRLF
    			strHTML = strHTML & "	function WriteSeasonCombo_OnChangeEventHandler() {" & vbCRLF
    			strHTML = strHTML & "		var objElement = document.getElementById(" & Chr(34) & "lisSeason" & Chr(34) & ")" & ";" & vbCRLF
    			strHTML = strHTML & "alert(objElement.size);" & vbCRLF
    
    			strHTML = strHTML & vbCRLF
    			strHTML = strHTML & "		if( window.addEventListener ) {" & vbCRLF
    			strHTML = strHTML & "		    objElement.addEventListener('onchange', Statistics_ChangePage, false);" & vbCRLF
    			strHTML = strHTML & "		  } else if(window.attachEvent){" & vbCRLF
    			strHTML = strHTML & "		    objElement.attachEvent('onchange', Statistics_ChangePage());" & vbCRLF
    			strHTML = strHTML & "		  }" & vbCRLF
    			strHTML = strHTML & "	}" & vbCRLF
    			strHTML = strHTML & vbCRLF
    			strHTML = strHTML & "	WriteSeasonCombo();" & vbCRLF
    			strHTML = strHTML & "	WriteSeasonCombo_OnChangeEventHandler();" & vbCRLF
    			strHTML = strHTML & "</SCRIPT>" & vbCRLF
    
    			Response.Write strHTML
    		End If
    
    		'// We'd better cater for the impossible - no season nbr
    		If intSeasonNo = 0 Then
    			With RS
    				.MoveLast
    				intSeasonNo	= .Fields("SeasonNo")
    			End With
    		End If
    
    		RS.Close
    		Set RS = Nothing
    
    		blnResult = CloseConnection()
    	End Sub
    and produces this on the rendered page:
    Code:
    								<SCRIPT type='text/vbscript'>
    	Sub Statistics_ChangePage(ByVal intSeasonIndex, ByVal intPageNumber)
    
    		document.forms("frmStatistics").action="../asp/statistics.asp?Page=" & intPageNumber & "&SeasonNo=" & intSeasonIndex
    		document.forms("frmStatistics").submit()
    	End Sub
    </SCRIPT>
    <SCRIPT type='text/javascript'>
    	function WriteSeasonCombo() {
    		var objElement;
    		var objOption;
    
    		document.getElementById("spanHeaderExtension").innerHTML=" for Season ";
    
    		objElement 	= document.createElement("SELECT");
    		objElement.setAttribute("NAME","lisSeason");
    		objElement.setAttribute("ID","lisSeason");
    		objElement.setAttribute("SIZE","1");
    		objElement.setAttribute("STYLE","WIDTH:90");
    
    		document.getElementById("spanHeaderExtension").appendChild(objElement);
    		objOption 	= document.createElement("option");
    		objOption.Value = "1";
    		objOption.appendChild(document.createTextNode("1993/1994"));
    		objElement.appendChild(objOption);
    
    		objOption 	= document.createElement("option");
    		objOption.Value = "2";
    		objOption.appendChild(document.createTextNode("1994/1995"));
    		objElement.appendChild(objOption);
    
    		objOption 	= document.createElement("option");
    		objOption.Value = "3";
    		objOption.appendChild(document.createTextNode("1995/1996"));
    		objElement.appendChild(objOption);
    
    		objOption 	= document.createElement("option");
    		objOption.Value = "4";
    		objOption.appendChild(document.createTextNode("1996/1997"));
    		objElement.appendChild(objOption);
    
    		objOption 	= document.createElement("option");
    		objOption.Value = "5";
    		objOption.appendChild(document.createTextNode("1997/1998"));
    		objElement.appendChild(objOption);
    
    		objOption 	= document.createElement("option");
    		objOption.Value = "6";
    		objOption.appendChild(document.createTextNode("1998/1999"));
    		objElement.appendChild(objOption);
    
    		objOption 	= document.createElement("option");
    		objOption.Value = "7";
    		objOption.appendChild(document.createTextNode("1999/2000"));
    		objElement.appendChild(objOption);
    
    		objOption 	= document.createElement("option");
    		objOption.Value = "8";
    		objOption.appendChild(document.createTextNode("2000/2001"));
    		objElement.appendChild(objOption);
    
    		objOption 	= document.createElement("option");
    		objOption.Value = "9";
    		objOption.appendChild(document.createTextNode("2001/2002"));
    		objElement.appendChild(objOption);
    
    		objOption 	= document.createElement("option");
    		objOption.Value = "10";
    		objOption.appendChild(document.createTextNode("2002/2003"));
    		objElement.appendChild(objOption);
    
    		objOption 	= document.createElement("option");
    		objOption.Value = "11";
    		objOption.appendChild(document.createTextNode("2003/2004"));
    		objElement.appendChild(objOption);
    
    		objOption 	= document.createElement("option");
    		objOption.Value = "12";
    		objOption.appendChild(document.createTextNode("2004/2005"));
    		objElement.appendChild(objOption);
    
    		objOption 	= document.createElement("option");
    		objOption.Value = "13";
    		objOption.appendChild(document.createTextNode("2005/2006"));
    		objElement.appendChild(objOption);
    
    		objOption 	= document.createElement("option");
    		objOption.Value = "14";
    		objOption.appendChild(document.createTextNode("2006/2007"));
    		objElement.appendChild(objOption);
    
    		objOption 	= document.createElement("option");
    		objOption.Value = "15";
    		objOption.appendChild(document.createTextNode("2007/2008"));
    		objElement.appendChild(objOption);
    
    		objOption 	= document.createElement("option");
    		objOption.Value = "16";
    		objOption.appendChild(document.createTextNode("2008/2009"));
    			objOption.Selected = "true";
    		objElement.appendChild(objOption);
    
    	}
    
    	function WriteSeasonCombo_OnChangeEventHandler() {
    		var objElement = document.getElementById("lisSeason");
    alert(objElement.size);
    
    		if( window.addEventListener ) {
    		    objElement.addEventListener('onchange', Statistics_ChangePage, false);
    		  } else if(window.attachEvent){
    		    objElement.attachEvent('onchange', Statistics_ChangePage());
    		  }
    	}
    
    	WriteSeasonCombo();
    	WriteSeasonCombo_OnChangeEventHandler();
    </SCRIPT>
    However, when it comes to the 'alert' line, I'm pretty much back where I was, in that I get an 'Object required' error. That has to be because the code can't see 'lisSeason'. Still! Arrrrgh!

    I have attached a ZIP with the entire HTML for the rendered page.
    Attached Files Attached Files

  • #11
    New to the CF scene
    Join Date
    Jun 2013
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I meant to add...

    - any elements in pages I build have an ID as well as a name;
    - it's curious that, when the source is viewed, the rendered page shows the code to create the d/d (which appears correctly) rather than the HTML to produce it.

  • #12
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,825
    Thanks
    78
    Thanked 4,413 Times in 4,378 Posts
    Well, for what it's worth, it is definitely an MSIE-only quirk.

    If you run the code in Chrome, for example, it works just fine (except, of course, none of the VBScript code works).

    But I do have to ask a question: What possible reason do you have to create the <select> in client-side code, instead of just doing it in the back-end ASP code???
    Last edited by Old Pedant; 06-08-2013 at 02:42 AM.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #13
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,825
    Thanks
    78
    Thanked 4,413 Times in 4,378 Posts
    And this code is as ugly as pig snot:
    Code:
    		objOption 	= document.createElement("option");
    		objOption.Value = "1";
    		objOption.appendChild(document.createTextNode("1993/1994"));
    		objElement.appendChild(objOption);
    
    		objOption 	= document.createElement("option");
    		objOption.Value = "2";
    		objOption.appendChild(document.createTextNode("1994/1995"));
    		objElement.appendChild(objOption);
    
    		objOption 	= document.createElement("option");
    		objOption.Value = "3";
    		objOption.appendChild(document.createTextNode("1995/1996"));
    		objElement.appendChild(objOption);
    
    		objOption 	= document.createElement("option");
    		objOption.Value = "4";
    		objOption.appendChild(document.createTextNode("1996/1997"));
    		objElement.appendChild(objOption);
    
    		objOption 	= document.createElement("option");
    		objOption.Value = "5";
    		objOption.appendChild(document.createTextNode("1997/1998"));
    		objElement.appendChild(objOption);
    
    		objOption 	= document.createElement("option");
    		objOption.Value = "6";
    		objOption.appendChild(document.createTextNode("1998/1999"));
    		objElement.appendChild(objOption);
    
    		objOption 	= document.createElement("option");
    		objOption.Value = "7";
    		objOption.appendChild(document.createTextNode("1999/2000"));
    		objElement.appendChild(objOption);
    
    		objOption 	= document.createElement("option");
    		objOption.Value = "8";
    		objOption.appendChild(document.createTextNode("2000/2001"));
    		objElement.appendChild(objOption);
    
    		objOption 	= document.createElement("option");
    		objOption.Value = "9";
    		objOption.appendChild(document.createTextNode("2001/2002"));
    		objElement.appendChild(objOption);
    
    		objOption 	= document.createElement("option");
    		objOption.Value = "10";
    		objOption.appendChild(document.createTextNode("2002/2003"));
    		objElement.appendChild(objOption);
    
    		objOption 	= document.createElement("option");
    		objOption.Value = "11";
    		objOption.appendChild(document.createTextNode("2003/2004"));
    		objElement.appendChild(objOption);
    
    		objOption 	= document.createElement("option");
    		objOption.Value = "12";
    		objOption.appendChild(document.createTextNode("2004/2005"));
    		objElement.appendChild(objOption);
    
    		objOption 	= document.createElement("option");
    		objOption.Value = "13";
    		objOption.appendChild(document.createTextNode("2005/2006"));
    		objElement.appendChild(objOption);
    
    		objOption 	= document.createElement("option");
    		objOption.Value = "14";
    		objOption.appendChild(document.createTextNode("2006/2007"));
    		objElement.appendChild(objOption);
    
    		objOption 	= document.createElement("option");
    		objOption.Value = "15";
    		objOption.appendChild(document.createTextNode("2007/2008"));
    		objElement.appendChild(objOption);
    
    		objOption 	= document.createElement("option");
    		objOption.Value = "16";
    		objOption.appendChild(document.createTextNode("2008/2009"));
    			objOption.Selected = "true";
    		objElement.appendChild(objOption);
    Why not simply:
    Code:
        for ( var ov = 1; ov <= 16; ++ov )
        [
    		objOption 	= new Option( (1992+ov) + "/" + (1993+ov), ov );
    		objElement.appendChild(objOption);
        }
    Though I still don't see why you can't do this in the ASP code.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #14
    New to the CF scene
    Join Date
    Jun 2013
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    >Why not simply:
    If you look in the ASP page, that's pretty much exactly what it does, except in VBS, rather than JS. What you see in STATS.HTM is the code which gets "rendered" after the ASP has built it and the client has run it. Again, I have to wonder how it is that the d/d appears on the rendered page but none of the HTML that created it appears when you 'View Source'!

    >why you can't do this in the ASP code.
    I can. And did, using the 'InnerHTML property, but the onChange event didn't seem to ever fire. I read - in several posts on other fora - that this is yet another IE quirk and that, to get it to work, you had to use the convoluted route we now have.

    If I move the d/d so that it appears along with the rest of the HTML - i.e. not in the "header" row (where it says 'Statistic for Season [d/d]') - it works just fine and this is how it used to work when the site was built using an HTML "container" file and a companion ASP file to populate the HTML page. The author then decided to consolidate the twelve HTML pages into one, a worthy enough desire.

    So my choices are:
    - reposition the d/d and "draw" it in ASP
    - abandon the whole thing

    We don't really want to do change the position, because we'd end up with an odd, wasted line on the rendered page and quite a bit of work in the ASP re-doing the tables (I know, I know!!). As for abandonment, well, I'm not one to give up so easily. I remember being told that one couldn't script the link-ordering of Group Policy objects. Ha!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •