Questions about MM_jumpMenu(targ,selObj,restore)

Results 1 to 6 of 6

Thread: Questions about MM_jumpMenu(targ,selObj,restore)

  1. #1
    Join Date
    Dec 1969
    Posts
    320

    Default Questions about MM_jumpMenu(targ,selObj,restore)

    The code is here:<BR>------------------------------------------------------------<BR>function MM_jumpMenu(targ,selObj,restore)<BR>{var NumOfDay= document.myform.NumOfDay.value;<BR> var NumOfMonth= document.myform.NumOfMonth.value;<BR> eval(targ+".location=&#039;"+selObj.options[selObj.selectedIndex].value+"&D=" + NumOfDay +"&M=" + NumOfMonth + "&#039;");<BR>}<BR>&#060;%<BR>&#039;---From MM_jumpMenu()---<BR>strDay = request.QueryString("D")<BR>strMonth = request.QueryString("M")<BR>&#039;---From Database---<BR>strDay = rs("Day")<BR>strMonth = rs("Month")<BR>%&#062;<BR>&#060;tr&#062;&#060;td&# 062;Day:&#060;/td&#062;&#060;td&#062;&#060;select name="NumOfDay" id="NumOfDay"&#062;<BR> &#060;option value="1" &#060;%if strDay="1" then %&#062;selected &#060;%end if%&#062;&#062;1&#060;/option&#062;<BR> &#060;option value="2" &#060;%if strDay="2" then %&#062;selected &#060;%end if%&#062;&#062;2&#060;/option&#062;<BR> &#060;/select&#062;&#060;/td&#062;&#060;/tr&#062;<BR>&#060;tr&#062;&#060;td&#062;Month:&#06 0;/td&#062;&#060;td&#062;&#060;select name="NumOfMonth" id="NumOfMonth"&#062;<BR> &#060;option value="1" &#060;%if strMonth="1" then %&#062;selected &#060;%end if%&#062;&#062;1&#060;/option&#062;<BR> &#060;option value="2" &#060;%if strMonth="2" then %&#062;selected &#060;%end if%&#062;&#062;2&#060;/option&#062;<BR> &#060;/select&#062;&#060;/td&#062;&#060;/tr&#062;<BR>&#060;tr&#062;&#060;td&#062;Choice:&#0 60;/td&#062;<BR> &#060;td&#062;&#060;select name="Choice" id="Choice" onChange="MM_jumpMenu(&#039;parent&#039;,this,0)"& #062;<BR> &#060;option value="file.asp"&#062;No Preference&#060;/option&#062;<BR> ..........<BR> &#060;/select&#062;&#060;/td&#062;&#060;/tr&#062;<BR>-----------------------------------------------------------------<BR>The purpose of the code above is: <BR>1. The strDay from Database in charge first.<BR>2. The strDay from QueryString takes charge only when MM_jumpMenu() triggered.<BR>----------------------------------------------------------------<BR>Evidently, only the second strDay (either from Database or QueryString) <BR>determines which one get selected in the form.<BR>----------------------------------------------------------------<BR>I know how to hide it, but don&#039;t how to disable(or whatever) it:<BR>function Hide(obj){document.getElementById(obj).style.displ ay=&#039;none&#039;;}<BR>&#060;table id="ppp" style="display:&#039;&#039;;"&#062;&#060;tr&#062;& #060;td&#062;<BR>&#060;% strDay = rs("Day")<BR> strMonth = rs("Month")<BR>%&#062;&#060;/td&#062;&#060;/tr&#062;&#060;/table&#062;<BR>.......... onChange="MM_jumpMenu(&#039;parent&#039;,this,0);H ide(ppp)"<BR>------------------------------------------------------------<BR>Please help me on this.<BR><BR>Thanks a lot.<BR>

  2. #2
    Join Date
    Dec 1969
    Posts
    2,892

    Default RE: Questions about MM_jumpMenu(targ,selObj,restor

    Am leaving soon so I don&#039;t have time to try and help right now. Look over this thread and see if anything there helps.<BR><BR>http://www.aspmessageboard.com/forum/jscript.asp?M=799872&T=799251&F=29&P=1#799251

  3. #3
    Join Date
    Dec 1969
    Posts
    96,020

    Default Did DreamWeaver *really* produce that code???

    That code is buggy, just in the second line!<BR><BR>function MM_jumpMenu(targ,selObj,restore)<BR>{<BR> var NumOfDay = document.myform.NumOfDay.value; <BR><BR>You can&#039;t use .value on a &#060;SELECT&#062; element in some browsers!!!<BR><BR>That&#039;s scary that DW would produce code that doesn&#039;t work cross-browser.<BR><BR>And then THIS code makes even LESS sense:<BR>&#060;%<BR>&#039;---From MM_jumpMenu()---<BR>strDay = request.QueryString("D")<BR>strMonth = request.QueryString("M")<BR>&#039;---From Database---<BR>strDay = rs("Day")<BR>strMonth = rs("Month")<BR>%&#062;<BR><BR>WHAT??? I presume this must be your code, not DW&#039;s.<BR><BR>WHAT IS THE POINT of even *trying* to get these two values:<BR> strDay = request.QueryString("D")<BR> strMonth = request.QueryString("M")<BR>when you then turn right around and WIPE THEM OUT in the next two lines????<BR><BR>SO...<BR><BR>You wrote:<BR>The purpose of the code above is: <BR>1. The strDay from Database in charge first.<BR>2. The strDay from QueryString takes charge only when MM_jumpMenu() triggered.<BR><BR><BR>No, that is not true. As your code is written, the strDay from querystring is *ALWAYS* simply ignored.<BR><BR>

  4. #4
    Join Date
    Dec 1969
    Posts
    320

    Default Jump() has no problem but

    Sorry for the confusing info.<BR>My goal is:<BR>1.When this page gets loaded first, the first two dropdown lists(day, month) select what¡¯s in the database.<BR>2.Next I may make change to the first two dropdown lists contents.<BR>3.Third, when I change the third dropdown list (car make, also from DB),all the dropdown lists choice before it (first two dropdown)can be kept as what I just changed.<BR><BR>But the problem is when I change the third dropdown list, the whole page will get refreshed by its self(I don¡¯t want to), and all the dropdown lists choice before it get delected(to default).<BR><BR>My jump function and ASP work good seperately,<BR>In other word, if I delete the string from DB, Jump() works.<BR>If I delete the Quearystring from Jump(), the dropdown lists<BR>Selecte what¡¯ in the DB, no problem at all.<BR><BR>But if I put the together, only the last string in charge,<BR><BR>For example: <BR>strDay = rs("Day") ---&#062;10<BR>strDay = request.QueryString("D") ---&#062; 20<BR><BR>then the strDay=20 is what¡¯s the dropdown list used to judge.<BR><BR>Hope you can have a better idea of my goal and problem<BR>Thanks<BR>


  5. #5
    Join Date
    Dec 1969
    Posts
    96,020

    Default Okay, that's easy...

    &#060;% <BR>&#039; first, see if we got values from prior use of the page:<BR>iDay = CLng( "0" & request.QueryString("D"))<BR>iMonth = CLng( "0" & request.QueryString("M"))<BR>&#039; but if there is nothing from the &#060;FORM&#062; from prior use, then...<BR>If iDay = 0 Then<BR> iDay = rs("Day") <BR> iMonth = rs("Month") <BR>End If<BR>%&#062; <BR><BR>I change from strDay to iDay because presumably and hopefully those really *ARE* integer values in the database. (And if they aren&#039;t they should be.) What does you SQL query look like? I didn&#039;t see it there.<BR><BR>

  6. #6
    Join Date
    Dec 1969
    Posts
    320

    Default Thank you Bill and KurtW !

    You are right, it&#039;s easy, but not for me.<BR>You&#039;ve helped me a lot, a lot.<BR>Every time I water down my code as far as I can to save you and others&#039; time. I even change field name to an easy and short one.<BR>Hope it won&#039;t confuse you next time.<BR><BR>Have a great weekend !

Posting Permissions

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