[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Wierd JS problem



Here is an interesting JS problem. The code below does not work unless the indicated 
line is removed. As far as I can tell, the indicated line should not have any 
influence on the script.
Specifically: click the "Read this topic" button and JS returns "SubTopics has no 
properties." Remove the indicated line and it runs just fine. But this line should not 
matter at all.

I'm sure I can work around it but I don't understand it. If nobody can find a problem 
with it, I would be interested in seeing if it occurs on all platforms. I'm running NT 
and will check 95 and 3.11 but if anybody could check Mac and UNIX it might be 
interesting.

By the way, I know this isn't exactly a model of HTML or Javascript, it was just a 
quick hack to test the concept.

<HTML>
<SCRIPT LANGUAGE="JAVASCRIPT">
        function newtopic(form) {
        var id = form.SubTopicID.options[form.SubTopicID.selectedIndex].value
                alert("ID="+id)
                parent.CurrentTopicID=id
parent.window.SUBTOPICS.location.href="http://199.182.27.50/cgi-shl/dbml.exe?Template=
SubTopics.dbm&TopicID="+id
        }
        function dummy() {
                alert("Dummy Function")
        }
</SCRIPT>

<HEAD>

<TITLE>Untitled</TITLE>

<META NAME="GENERATOR" CONTENT="Internet Assistant for Microsoft Word 2.0z Beta">
</HEAD>

<BODY>
<P>
<TABLE BORDER=1 CELLSPACING=0 CELLPADING=0>
<TR>
        <TD>
        <FORM NAME="SubTop">
                <CENTER><INPUT TYPE="button" VALUE="Read This Topic:" 			
onClick="newtopic(this.form)">
                <SELECT NAME="SubTopicID">
                        
                                <OPTION VALUE="1">Ford
                                <OPTION VALUE="2">Masserati
                                <OPTION VALUE="3">BMW
                                <OPTION VALUE="4">Catapiller
                </SELECT>
                </CENTER>
        </TD>
        <TD><INPUT TYPE="button" VALUE="Create new topic" onClick="dummy()"></TD>
        <TD><INPUT TYPE="button" VALUE="Create new subtopic" onClick="dummy()"></TD>
        <TD><INPUT TYPE="button" VALUE="Post a message" onClick="dummy()"></TD>
        ^^^^^^^^^^^REMOVE THE LINE ABOVE AND EVERYTHING WORKS^^^^^^^^
	</FORM>         
        </TR>
</TABLE>
</BODY>
</HTML>
--------------------------------------------------------------------
For help about the list, please send a message to 'majordomo@obscure.org'
with the message body 'help'. To unsubscribe, send a message to
'majordomo@obscure.org' with the message body 'unsubscribe javascript'.
List archives and pointer to FAQ: http://www.obscure.org/javascript/