Results 1 to 5 of 5

Thread: This javascript code cannot run in Mozilla but it runs in IE

  1. #1
    Join Date
    Feb 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default This javascript code cannot run in Mozilla but it runs in IE

    well, basically,when i click the submit button in the form..it will go to another page..in IE,the page loads up,but in mozilla,its not happening..


    '------DOUBLE CHECKING, CHECK IF USER HAS ALREADY SELECTED YES OR NO BEFORE--------------
    Dim objRstMatchReport
    varOptCompleted = Request.Form("optCompleted")
    call associateRecordset(objConn, objRstMatchReport)
    objRstMatchReport.Open("SELECT * FROM tblrMatchReport WHERE MatchNo=" & varMatchNo & " AND TeamNo=" & varTeamNo)
    If NOT objRstMatchReport.EOF then
    Response.Redirect("verify_QuantitativeReport_Error.asp?LeagueNo=" & varLeagueNo)
    End if
    call closeRecordset(objRstMatchReport)
    call closeDatabaseConnection(objConn)


    Dim strFormAction
    Select Case varOptCompleted
    Case 1
    strFormAction = "manageMatchReport.asp?leagueNo=" & varLeagueNo
    Case 2
    strFormAction = "manageMatchException.asp?leagueNo=" & varLeagueNo
    End Select



    // this is the part that is not working..i am not sure whereis the problem..

    Response.Write("<script language=""Javascript"" for=""window"" event=""onLoad"">" & vbcrlf)
    Response.Write("document.frmMatchReport.action = """ & strFormAction & """;" & vbcrlf)
    Response.Write("document.frmMatchReport.submit();" & vbcrlf)
    Response.Write("</script>")


    //this is the form..
    <form method="post" name="frmMatchReport" id="frmMatchReport">
    <table border="0" cellpadding="3" cellspacing="0" width="100%">
    <tr>
    <td height="20"><input type="hidden" id="txtMatchNo" name="txtMatchNo" value="<%=varMatchNo%>"</td>
    </tr>
    <tr>
    <td><font class="bodytext"><b>PLEASE CHOOSE:</b></font></td>
    </tr>
    <tr>
    <td height="5"></td>
    </tr>
    <tr>
    <td><font class="bodytext">Did the match take place with a "Final result" ie first half completed on <u><%=Session("MatchDate")%></u></font></td>
    </tr>
    <tr>
    <td height="10"></td>
    </tr>
    <tr>
    <td><input type="radio" name="optCompleted" id="optCompleted" checked value="1">&nbsp;&nbsp;<font class="bodytext">YES</font></td>
    </tr>
    <tr>
    <td><input type="radio" name="optCompleted" id="optCompleted" value="2">&nbsp;&nbsp;<font class="bodytext">NO</font></td>
    </tr>
    <tr>
    <td><input type="submit" value="continue" name="yes" class="button"></td>
    </tr>
    </table>
    </form>

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    This javascript code cannot run in Mozilla but it runs in IE
    That would be because it isn't Javascript. It's VBScript, which is a proprietary extension found only in IE. It won't run in any other browsers.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Feb 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    ok..Do u have any idea how am i supposed to change it...I dun have any idea..

  4. #4
    Join Date
    Feb 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I just cannot find out where is the error..Please help if u knoe..This is the full code..


    <% Response.Buffer = True %>
    <!--#include FILE="config.asp" -->
    <!--#include FILE="inc/sessionvar.txt" -->
    <% Session("page") = "matchreport"%>
    <%
    Dim varTeamNo, varTeamName, varLeagueNo
    varLeagueNo = Request.QueryString("leagueNo")
    If varLeagueNo = "" OR (Not IsNumeric(varLeagueNo)) then
    Response.Redirect("home.asp")
    End IF

    Dim objConn, objRstLeague, objRstTeams
    call openDatabaseConnection(objConn)
    call associateRecordset(objConn, objRstLeague)
    objRstLeague.Open("SELECT * FROM tblmLeague WHERE uniLeagueNo=" & varLeagueNo)
    If objRstLeague.Recordcount = 0 then
    Response.Redirect("home.asp")
    End If
    call closeRecordset(objRstLeague)

    varTeamNo = Session("teamNo")

    If varTeamNo = "" Or IsNull(varTeamNo) then
    Response.Redirect("teamLogin.asp?leagueNo=" & varLeagueNo)
    End If

    call associateRecordset(objConn,objRstTeams)
    objRstTeams.Open("SELECT * FROM tblmLeagueTeams WHERE TeamNo=" & varTeamNo & " AND LeagueNo=" & varLeagueNo)
    If objRstTeams.Recordcount = 0 then
    Response.Redirect("teamLogout.asp?leagueNo=" & varLeagueNo)
    End If
    call closeRecordset(objRstTeams)

    Session("page") = ""
    call associateRecordset(objConn, objRstTeams)

    objRstTeams.Open("SELECT TeamName FROM tblmTeams WHERE TeamNo=" & varTeamNo)
    varTeamName = Trim(objRstTeams("TeamName"))
    call closeRecordset(objRstTeams)

    Dim varHomeNo, varAwayNo, varMatchNo
    Dim varOpposition, varMatchDate, varTime
    Dim varOptCompleted

    varMatchNo = Request.Form("txtMatchNo")



    '-----SAVE WHAT THE USER HAS SELECTED (IF GAME WAS COMPLETED OR NOT)-----------
    If Request.Form("optCompleted") = "" or IsNull(Request.Form("optCompleted")) then
    dim objRstMatch , strQueryMatch
    call associateRecordset(objConn,objRstMatch)
    strQueryMatch = "SELECT tblmMatch.MatchDate AS MatchDate, tblmMatch.Time AS [Time]," _
    & "tblmMatch.Venue AS Venue, tblmTeams.TeamName AS HomeTeam, tblmTeams_1.TeamName AS AwayTeam," _
    & "tblmMatch.HomeTeamUniNo AS HomeTeamNo, tblmMatch.AwayTeamUniNo AS AwayTeamNo " _
    & "FROM (tblmMatch INNER JOIN tblmTeams ON tblmMatch.HomeTeamUniNo = tblmTeams.TeamNo) " _
    & "INNER JOIN tblmTeams AS tblmTeams_1 ON tblmMatch.AwayTeamUniNo = tblmTeams_1.TeamNo " _
    & "WHERE tblmMatch.MatchNo=" & varMatchNo
    objRstMatch.Open(strQueryMatch)

    varHomeNo = objRstMatch("HomeTeamNo")
    varAwayNo = objRstMatch("AwayTeamNo")

    If Cint(varHomeNo) = Cint(varTeamNo) then
    varOpposition = objRstMatch("AwayTeam")
    End if

    If Cint(varAwayNo) = Cint(varTeamNo) then
    varOpposition = objRstMatch("HomeTeam")
    End if

    varMatchDate = objRstMatch("MatchDate")
    varMatchDate = Day(varMatchDate) & "-" & MonthName(Month(varMatchDate),True) & "-" & Year(varMatchDate)
    varTime = objRstMatch("Time")
    varVenue = objRstMatch("Venue")

    call closeRecordset(objRstMatch)


    Else
    '------USER HAS SELECTED (GAME WAS COMPLETED OR NOT)--------------


    '------DOUBLE CHECKING, CHECK IF USER HAS ALREADY SELECTED YES OR NO BEFORE--------------
    Dim objRstMatchReport
    varOptCompleted = Request.Form("optCompleted")
    call associateRecordset(objConn, objRstMatchReport)
    objRstMatchReport.Open("SELECT * FROM tblrMatchReport WHERE MatchNo=" & varMatchNo & " AND TeamNo=" & varTeamNo)
    If NOT objRstMatchReport.EOF then
    Response.Redirect("verify_QuantitativeReport_Error.asp?LeagueNo=" & varLeagueNo)
    End if
    call closeRecordset(objRstMatchReport)
    call closeDatabaseConnection(objConn)


    Dim strFormAction
    Select Case varOptCompleted
    Case 1
    strFormAction = "manageMatchReport.asp?leagueNo=" & varLeagueNo
    Case 2
    strFormAction = "manageMatchException.asp?leagueNo=" & varLeagueNo
    End Select

    Response.Write("<script language=""Javascript"" for=""window"" event=""onLoad"">" & vbcrlf)
    Response.Write("document.frmMatchReport.action = """ & strFormAction & """;" & vbcrlf)
    Response.Write("document.frmMatchReport.submit();" & vbcrlf)
    Response.Write("</script>")
    End if
    %>
    <html>
    <head>
    <link href="espzen.css" rel="stylesheet" type="text/css">
    <!--#include FILE="inc/title.txt"-->
    </head>
    <body bgcolor="#4B4D4A" topmargin="0" leftmargin="0" marginwidth="0" marginheight="0" text="#000000" width="100%">
    <script type='text/javascript'>
    function Go(){return}
    </script>
    <script type="text/javascript" src="js/exmplmenu_var.js"></script>
    <script type="text/javascript" src="js/menu_com.js"></script>
    <noscript>Your browser does not support script</noscript>
    <table border="0" cellpadding="0" cellspacing="0" width="750" height="100%" align="center">
    <!--#include FILE="inc/header.txt" -->
    <tr>
    <td width="135" valign="top" bgcolor="#303030"><!--#include FILE="inc/menu_left.txt" --></td>
    <td width="5" valign="top" bgcolor="#FFFFFF"></td>
    <td width="580" valign="top" bgcolor="#FFFFFF">
    <!--#include FILE="inc/date_time.txt" -->
    <table border="0" cellpadding="0" cellspacing="2" width="100%">
    <tr>
    <td colspan="2">
    <% If varLeagueNo = 1 then %>
    <font class="bodytext17"><font color="red"><b>MATADOR Systems</font> Champions League</font>
    <% ElseIf varLeagueNo = 2 then %>
    <font class="bodytext17"><font color="blue"><b>Traveldestinee</font> Midweek League</font></b>
    <% ElseIf varLeagueNo = 3 then %>
    <font class="bodytext17"><b><font color="orange">ESPZEN</font> Challenge League</font></b>
    <% ElseIf varLeagueNo = 4 then %>
    <font class="bodytext17"><font color="red"><b>ESPZEN Sunday</font> League Season 2</font>
    <% ElseIf varLeagueNo = 5 then %>
    <font class="bodytext17"><font color="blue"><b>Traveldestinee</font> Midweek League Season 2</font></b>
    <% ElseIf varLeagueNo = 6 then %>
    <font class="bodytext17"><b><font color="orange">1NiteStand</font> Knock Out Cup</b></font>
    <% ElseIf varLeagueNo = 7 then %>
    <font class="bodytext17"><b><font color="blue">ESPZEN</font> Weekend Morning League</b> </font>
    <% ElseIf varLeagueNo = 8 then %>
    <font class="bodytext17"><b><font color="blue">ESPZEN</font> Weekend Morning League 2</b>
    <% ElseIf varLeagueNo = 9 then %>
    <font class="bodytext17"><font color="red"><b>ESPZEN Sunday</font> League Season 3</font>
    <% ElseIf varLeagueNo = 11 then %>
    <font class="bodytext17"><font color="blue"><b>Traveldestinee</font> Midweek League Season 3</font></b>
    <% End If %>
    </td>
    </tr>
    <tr>
    <td colspan="3"><font class="bodytext"><b>Welcome: </b><u><%=varTeamName%></u>:</font></td>
    </tr>
    <tr>
    <td align="right" colspan="3">
    <a class="list" href="managematch.asp?leagueNo=<%=varLeagueNo%>"><u>back to list of matches</u></a>
    <font class="bodytext">&nbsp;|&nbsp;</font>
    <!--<a class="list" href="managematch_edit.asp?leagueNo=<%=varLeagueNo%>"><u>edit qualitative match reports</u></a>-->
    <!--<font class="bodytext">&nbsp;|&nbsp;</font>-->
    <a class="list" href="teamLogout.asp?leagueNo=<%=varLeagueNo%>"><u>logout</u></a>
    </td>
    </tr>
    <tr>
    <td height="10" colspan="3"></td>
    </tr>
    <tr>
    <td width="5%"></td>
    <td width="90%">
    <table border="0" cellpadding="3" cellspacing="0" width="100%">
    <tr>
    <td width="25%"><font class="bodytext"><b>Match Date:</b></font></td>
    <td width="5%"></td>
    <td><font class="bodytext"><u><%=varMatchDate%></u></font></td>
    </tr>
    <tr>
    <td><font class="bodytext"><b>Match Time:</b></font></td>
    <td></td>
    <td><font class="bodytext"><u><%=varTime%></u></font></td>
    </tr>
    <tr>
    <td><font class="bodytext"><b>Venue:</b></font></td>
    <td></td>
    <td><font class="bodytext"><u><%=varVenue%></u></font></td>
    </tr>
    <tr>
    <td><font class="bodytext"><b>Opposition Team:</b></font></td>
    <td></td>
    <td><font class="bodytext"><u><%=varOpposition%></u></font></td>
    </tr>
    </table>
    <form method="post" name="frmMatchReport" id="frmMatchReport">
    <table border="0" cellpadding="3" cellspacing="0" width="100%">
    <tr>
    <td height="20"><input type="hidden" id="txtMatchNo" name="txtMatchNo" value="<%=varMatchNo%>"</td>
    </tr>
    <tr>
    <td><font class="bodytext"><b>PLEASE CHOOSE:</b></font></td>
    </tr>
    <tr>
    <td height="5"></td>
    </tr>
    <tr>
    <td><font class="bodytext">Did the match take place with a "Final result" ie first half completed on <u><%=Session("MatchDate")%></u></font></td>
    </tr>
    <tr>
    <td height="10"></td>
    </tr>
    <tr>
    <td><input type="radio" name="optCompleted" id="optCompleted" checked value="1">&nbsp;&nbsp;<font class="bodytext">YES</font></td>
    </tr>
    <tr>
    <td><input type="radio" name="optCompleted" id="optCompleted" value="2">&nbsp;&nbsp;<font class="bodytext">NO</font></td>
    </tr>
    <tr>
    <td><input type="submit" value="continue" name="yes" class="button"></td>
    </tr>
    </table>
    </form>
    <!--#include FILE="inc/footer.txt"-->
    </td>
    <td width="5%"></td>
    </tr>
    </table>
    </td>
    </tr>
    </table>
    </body>
    </html>

  5. #5
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    I do beg your pardon: the VBScript is server-side, and will not cause problems.
    Code:
    Response.Write("<script language=""Javascript"" for=""window"" event=""onLoad"">" & vbcrlf)
    Response.Write("document.frmMatchReport.action = """ & strFormAction & """;" & vbcrlf)
    Response.Write("document.frmMatchReport.submit();" & vbcrlf)
    Response.Write("</script>")
    Firstly, this "for" and "event" attribute business is nonsense. Forget it. The code should look like this:
    Code:
    <script type="text/javascript">
    window.onload = function() {
      document.frmMatchReport.action = "strFormAction";
      document.frmMatchReport.submit();
    }
    </script>
    Secondly, the first line (of Javascript; third in my code block) isn't required; use your server-side VBScript to enter that into the form as plain HTML.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

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