Passing JSP into JavaScript function
I have a database table containing a date for the end of an auction, I am able to successfully take the date from the database but I am having problems passing it and casting it to a date object within a javascript function. The purpose of the function is to begin a countdown to the passed in date. Any suggestions? The countdown function i have only works with a hard coded date object.
<SCRIPT LANGUAGE="JavaScript1.2">
mDate = new Date("October 18 2004")
function countdown(){
var now=new Date()
var diff=mDate.getTime()-now.getTime()
document.bid.days.value = Math.round(diff/(24*60*60*1000))
document.bid.hours.value = Math.round(diff/(60*60*1000))
document.bid.minutes.value = Math.round(diff/(60*1000))
document.bid.seconds.value = Math.round(diff/1000)
document.bid.mseconds.value = diff
var id=setTimeout("millenium()",1)
</SCRIPT>
<body onLoad="countdown()">
<form name="bid" method="post" action="">
<p>Timeleft</p>
<TABLE BORDER=0>
<TD width="79">Days: </TD>
<TD width="81">
<INPUT TYPE="text" NAME="days" SIZE=15></TD> <TR>
<TD width="79">Hours: </TD>
<TD width="81">
<INPUT TYPE="text" NAME="hours" SIZE=15></TD> <TR>
<TD width="79">Minutes:</TD>
<TD width="81">
<INPUT TYPE="text" NAME="minutes" SIZE=15></TD> <TR>
<TD width="79">Seconds: </TD>
<TD width="81">
<INPUT TYPE="text" NAME="seconds" SIZE=15></TD> <TR>
<TD width="79">Milliseconds:</TD>
<TD width="81">
<INPUT TYPE="text" NAME="mseconds" SIZE=15></TD> <TR>
</TABLE>
</form>
I wish to pass it as follows:
<body onLoad="countdown(<%rsProduct.get........%>)"> and then cast within the function
.............................................................................JSP.....................................................................................................
<% Connection dbConn = null;
try
Class.forName("com.sybase.jdbc2.jdbc.SybDriver");
dbConn = DriverManager.getConnection("jdbc:sybase:Tds:compserver:5000/syb3044","syb3044", "syb3044");
Statement select = dbConn.createStatement();
int ID = Integer.parseInt(request.getParameter("carId"));
ResultSet rsProduct = select.executeQuery("SELECT * FROM car WHERE carID =" + ID);
if(rsProduct.next()){}
<%
rsProduct.close();
catch (SQLException sqle)
out.println(sqle.getMessage());
catch (ClassNotFoundException cnfe)
out.println(cnfe.getMessage());
catch (Exception e)
out.println(e.getMessage());
finally
try
if(dbConn != null)
dbConn.close();
catch (SQLException sqle)
out.println(sqle.getMessage());
}%>
PLEASE NOTE THAT I AM A SECOND YEAR COMPUTER SCIENCE STUDY!
sorry if code is messy to read.
Regards
Looks like everyone's having a countdown problem.....
The script in this thread is awefully like in this one:http://forum.java.sun.com/thread.jsp?forum=45&thread=514095&tstart=0&trange=15
Anyway, there're what you can do. Write out the Date object in JSP as a Javascript Date, two ways to achieve that:
1, mydate.getTimeStamp() is should return a long value, time in millisec, so
var mDate = new Date(<%= myDate.getTimeStamp()%>);
2. a lil messy, use DateFormatter to format the sql.Date, this gives you a Date in Strint form. Do remember the exact API for the DataFormater, but something like this.
var mDate = new Date("<%= DateFormatter.format(myDate) %>");
I'd prefer the 1st approach, why changing a Date to String then just change to Date again....Also watch out the TimeZone stuff and Daylight saving time....have fun.
Similar Messages
-
Passing value from javascript function to servlet
Hello everybody,
i need to pass parameter from javascript function to servlet.
what i wrote is :
function callPopulateServlet(t)
var h =document.NewRequest.services;
var y = t.selectedIndex;
alert(h.options[y].value);
var id=h.options[y].value;
<%session.setAttribute("id",id);%> // am getting error at this point
document.NewRequest.submit();
with this id am quering values from database through servlet.
any body knows plz help me.
thanks,
anil.this is the error am getting
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:85)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:435)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:298)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:299)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803) -
How to pass parameter into extract function (for XMLTYPE)
I have a table PROBLEMXML with XMLTYPE field xml_column. In this column there are several deffinitions for the problem. There is no max amount of deffinitions and it can be no definition at all. I need to return all definitions for every problem as a string wirh definitions separated by ";".
Query
SELECT extract(prob.Def,'/Definitions/Definition[1]/@var') || ';'|| extract(prob.Def,'/Definitions/Definition[2]/@var')
FROM PROBLEMXML j ,
XMLTABLE (
'/problem'
PASSING j.xml_column
COLUMNS probid VARCHAR (31) PATH '/problem/@id',
Def XMLTYPE PATH '/problem/Definitions') prob
where PROBLEM_ID =1;
returns exactly what I want a;m.
But
declare
my_var varchar2(2000) :=null;
n1 number;
n2 number;
begin
n1:=1;
n2:=2;
SELECT extract(prob.Def,'/Definitions/Definition[n1]/@var') || '|'|| extract(prob.Def,'/Definitions/Definition[n2]/@var') into my_var
FROM ETL_PROBLEMXML_STG_T j ,
XMLTABLE (
'/problem'
PASSING j.xml_column
COLUMNS probid VARCHAR (31) PATH '/problem/@id',
Def XMLTYPE PATH '/problem/Definitions') prob
where PROBLEM_ID =1;
dbms_output.put_line(my_var);
end;
returns NULL.
Is there is a way to pass parameter into extract function?I need to return all definitions for every problem as a string wirh definitions separated by ";".In XQuery, there's the handy function "string-join" for that.
For example :
SQL> WITH etl_problemxml_stg_t AS (
2 SELECT 1 problem_id,
3 xmltype('<problem id="1">
4 <Definitions>
5 <Definition var="var1"></Definition>
6 <Definition var="var2"></Definition>
7 <Definition var="var3"></Definition>
8 </Definitions>
9 </problem>') xml_column
10 FROM dual
11 )
12 SELECT j.problem_id,
13 prob.probid,
14 prob.def
15 FROM etl_problemxml_stg_t j,
16 XMLTable(
17 'for $i in /problem
18 return element r
19 {
20 $i/@id,
21 element d { string-join($i/Definitions/Definition/@var, ";") }
22 }'
23 passing j.xml_column
24 columns
25 probid varchar2(30) path '@id',
26 def varchar2(100) path 'd'
27 ) prob
28 ;
PROBLEM_ID PROBID DEF
1 1 var1;var2;var3 -
Pass a Java Bean into Javascript function.
Good day. Please help urgent :
I am trying to pass an instance of MyBean class into a javascript function
This code is added to the form.
private String getJavaScriptForLaunchNewComponent()
StringBuffer sb = new StringBuffer();
sb.append("<SCRIPT language='JavaScript'>");
sb.append(" function testFunction(zBean) { ");
sb.append("popAssetWinSpecs = \"left=250,top=250,width=300,height=300,scrollbars=no,toolbar=no,menubar=no,resizable=no,status=no,titlebar=no,location=no\";");
sb.append("htmlfile=\"/irj/servlet/prt/portal/prtroot/com.roche.mss.pdf.comp.PDFLauncher?zBean=\"+zBean;");
sb.append("window.open(htmlfile,\"editWindow\",popAssetWinSpecs);");
sb.append("return false;");
sb.append(" }");
sb.append("</SCRIPT>");
return sb.toString();
This code is set in the create component meth
private Component buildLink(){
GridLayout grid = new GridLayout(1,1);
grid.setCellSpacing(5);
TestBean zBean = new TestBean();
zBean.setValue("Me Now");
Link link = new Link("myLink");
link.addText("Print PDF");
link.setOnClientClick("testFunction("+zBean +")");
grid.addComponent(1,1,link);
return grid;
Is this possible ????
Thanks.solved it. Thanks
-
How to pass value from Javascript function to a Java class method
Hi All,
I want to pass a value, which I catch in a Javascript function to a method in a Java class. I have tried many combinations but it gives me error.
This is the way I am doing
function assignBill() {
proj = projPh.substring(0,indSlash);
<% myproject.getProj(" project_cd = '" + proj + "'");%>
proj is the variable which I want to pass to getProj methods.
If any one has done this, please let me know. Thanks for your help.
Ritesh MehtaThe only way to receive something from clients page is to submit it somehow: through a form or link, but the info has to make it back to the server obviously. I dont know how your app works, but you can use the the javascript -location.href- function(i think) to submit the var to the server and process it there.
-
Is it possible to pass a SQL into a Function
DECLARE
f sys_refcursor;
RESULT NUMBER;
FUNCTION myfunction (r sys_refcursor)
RETURN NUMBER
IS
BEGIN
RETURN TO_NUMBER (TO_CHAR (r.dt, 'DD'));
END;
BEGIN
OPEN f FOR
SELECT SYSDATE dt
FROM DUAL;
RESULT := myfunction (f);
CLOSE f;
END;Yes you are allowed to pass ref cursor but they have to processed the way you processur cursor i.e. OPEN, FETCH, CLOSE.
See demonostration of working code:
SQL>DECLARE
2 f sys_refcursor;
3 RESULT NUMBER;
4
5 FUNCTION myfunction (r sys_refcursor)
6 RETURN NUMBER
7 IS
8 v_currDate DATE;
9
10 BEGIN
11 IF r%ISOPEN THEN
12 FETCH r INTO v_currDate;
13 END IF;
14
15 RETURN TO_NUMBER (TO_CHAR (v_currDate, 'DD'));
16 END;
17 BEGIN
18 OPEN f FOR
19 SELECT SYSDATE dt
20 FROM DUAL;
21
22 RESULT := myfunction (f);
23
24 DBMS_OUTPUT.PUT_LINE('Date : ' || RESULT );
25
26 CLOSE f;
27 END;
28 /
Date : 23
PL/SQL procedure successfully completed.
{code} -
How to set JavaBean in JSP using JavaScript function
Hello,
When a user clicks on an item, I want to execute a JavaScript function. Within that function, I want to set specific JavaBeans (<jsp:setProperty... />) within my JSP page.
Can anyone tell me how to do this or where I can find examples on how to set JavaBeans in a JSP page using JavaScript?
Thanks.
Pattry this:
your.jsp
<html>
<SCRIPT>function buttonClick()
{document.compform.submit();}
</SCRIPT>
<body>
<form name=compform method=post action='your.jsp'>
<%
//write your code which you want to execute once the button is submitted
String submit;
submit=request.getParameter("mysubmit");
if ((submit != null) && (! submit.equals("")))
%>
<input type=hidden name=mysubmit value="submit">
<input type=button value=add onclick='buttonClick()'>
</form></body></html> -
How to pass value from Javascript function to JSP ?
hi,
hello i have 2 jsp page and one external javascript page.
from page 1.jsp
i am calling a fuction named fun(1).and i am passing that value to external
javascript page
from external javascript.js
i am getting this value in the fun(w) and sending this Page2.jsp like this
var url = "page2.jsp?id ="+w;
http.open("get","page2.jsp?id ="+w );
and in page2.jsp
i am getting that value like
String k = request.getParameter("w");
but this is showing error. how cloud i get that value on this page2.jsp ?
plz any one help me to study this
regards
Vishnu Sankar Shello sir
thank u very much..i got the output
Message was edited by:
vishnu_shankar -
ResultSet date into JavaScript Function HELP!!
I am developing an auction web site for a end year project in college, it is all done except this countdown thingy. I got the 'endDate' of an auction in a table. I can get the date out no problem at all, where im stuck is where i gotta pass the date from the result set into the javascript countdown function so it can countdown to the end of the auction. Code below
<%@ page language = "java" contentType = "text/html"%>
<%@ page language = "java" import = "com.sybase.jdbcx.SybDriver" %>
<%@ page language = "java" import = "java.sql.*" %>
<%@ page language = "java" import = "java.util.*"%>
<% Connection dbConn = null;
try
Class.forName("com.sybase.jdbc2.jdbc.SybDriver");
dbConn = DriverManager.getConnection("jdbc:sybase:Tds:compserver:5000/syb3044","
syb3044", "syb3044");
Statement b = dbConn.createStatement();
ResultSet bid = b.executeQuery("select * from bid where carID=1");
if(bid.next()){}
%>
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
mDate = new Date("20 April 2004 16:45") //Hard Coded Date Here, Want ResultSet Date Passed Here
function countdown()
var now=new Date()
var diff=mDate.getTime()-now.getTime()
if (diff <= 0)
document.bid.mseconds.value = 0
return 0;
document.bid.days.value = Math.round(diff/(24*60*60*1000))
document.bid.hours.value = Math.round(diff/(60*60*1000))
document.bid.minutes.value = Math.round(diff/(60*1000))
document.bid.seconds.value = Math.round(diff/1000)
document.bid.mseconds.value = diff
var id=setTimeout("countdown()",0)
</SCRIPT>
</HEAD>
<BODY onLoad="countdown()">
<BR>
<form name="bid" method="post" action="">
<p>Timeleft</p>
<TABLE BORDER=0>
<TD width="79">Days: </TD>
<TD width="81">
<INPUT TYPE="text" NAME="days" SIZE=15></TD> <TR>
<TD width="79">Hours: </TD>
<TD width="81">
<INPUT TYPE="text" NAME="hours" SIZE=15></TD> <TR>
<TD width="79">Minutes:</TD>
<TD width="81">
<INPUT TYPE="text" NAME="minutes" SIZE=15></TD> <TR>
<TD width="79">Seconds: </TD>
<TD width="81">
<INPUT TYPE="text" NAME="seconds" SIZE=15></TD> <TR>
<TD width="79">Milliseconds:</TD>
<TD width="81">
<INPUT TYPE="text" NAME="mseconds" SIZE=15></TD> <TR>
</TABLE>
</form>
</BODY>
</HTML>
<%
bid.close();
catch (SQLException sqle)
out.println(sqle.getMessage());
catch (ClassNotFoundException cnfe)
out.println(cnfe.getMessage());
catch (Exception e)
out.println(e.getMessage());
finally
try
if(dbConn != null)
dbConn.close();
catch (SQLException sqle)
out.println(sqle.getMessage());
%>
...........................................................SQLTable.......................................................................................................................
create TABLE bid
bidID integer primary key,
carID numeric NOT NULL,
seller varchar(50) NOT NULL,
username varchar(50),
startDate varchar(25) not null,
endDate datetime not null
PS, tried putting endDate as varchar but same result
Please note I am a computer science student
Regards Don Colvinorg.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 19 in the jsp file: /Test.jsp
Generated servlet error:
[javac] Compiling 1 source file
C:\Tomcat\work\Catalina\localhost\Mess\org\apache\jsp\Test_jsp.java:55: cannot resolve symbol
symbol : class SimpleDateFormat
location: class org.apache.jsp.Test_jsp
out.print( new SimpleDateFormat("dd MMMM YYYY hh:MM").format(bid.getDate("endDate")) );
^
1 error
It throwing back this error, any suggestions -
Currently, My function is :
FUNCTION BooleanToVarChar2(p_Boolean_i Boolean)
RETURN VARCHAR2 IS
BEGIN
IF p_Boolean_i THEN
RETURN 'TRUE';
ELSE
RETURN 'FALSE';
END IF;
END;
But I face an error whenever I try to call this function. The error message is
The following error has occurred:
ORA-06550: line 5, column 36:
PLS-00382: expression is of wrong type
ORA-06550: line 5, column 18:
PLS-00306: wrong number or types of arguments in call to 'BOOLEANTOVARCHAR2'
declare
temp boolean;
begin
temp := true;
select BooleanToVarChar2(Temp) from dual;
end;
Any Suggestion? Help!
Message was edited by:
iMeSQL does not support booleans, so you cannot use them in straight SQL. you can use them in pl/sql. so:
declare
answer varchar2(100);
begin
answer := BooleanToVarChar2( TRUE );
end;
also, using a select without an INTO clause in pl/sql seems rather pointless. so if the above example doesn't meet your requirements, try to give a more meaningful example -
Hello friends,
I am displaying values ie, amounts in the screen using write statements here i have to display the
sign left side , i am using Function module 'CLOI_PUT_SIGN_IN_FRONT'
Does anybody help me - How to pass paramter into this Function module.
Regards,
PhaneendraIf you look to the code of the function module, you can see it is condensing the value.
I would make a copy of this function, and remove the condense lines to give the result you want.
data: text1(1) type c.
search value for '-'.
if sy-subrc = 0 and sy-fdpos <> 0.
split value at '-' into value text1.
condense value.
concatenate '-' value into value.
else.
condense value.
endif. -
Passing java parameter to javascript function in oa framework
hi all,
can anybody tell how to pass parameter to javascript function from java for example
OAMessageTextInputBean txtbean = (OAMessageTextInputBean)webBean.findChildRecursive("BuyerPrice");
String row = "rowid";
txtbean.setOnKeyUp("javascript:checkNumber("+row+")");
checknumber is javascript function defined .Hi,
go through http://forum.java.sun.com/thread.jspa?threadID=174157&messageID=539357
if ur requirement is just to pass a string to a JS function.
Thanks -
JSP Array to Javascript function :URGENT HELP
Hi,
i have problem in sending array from JSP to Javascript function. if you have any answer please let me know asap.
Thanks in advance.
-PriyaHi Kurt,
I have written follow. program . but still I'm getting errors.
I don't know what I'm doing wrong.
<HTML>
<HEAD>
<SCRIPT>
function showArray()
var str = new Array (<%for (int j=0; j<jspstr.length; j++);
out.print ("\"" + jspstr[j] + "\"" + (j<(jspstr.length-1)?",":""));%>);
alert ("Total elements received: " + str.length);
for (j in str)
alert ("element number " + j + " equals " + str[j]);
</SCRIPT>
</HEAD>
<BODY>
<FORM>
<%String[] jspstr = {"abc", "def", "ghi", "jkl"};%>
<SCRIPT>
showArray();
</SCRIPT>
</FORM>
</BODY>
</HTML>
com.ibm.servlet.engine.webapp.WebAppErrorReport: C:\Program Files\IBM\VisualAge for Java\ide\project_resources\IBM WebSphere Test Environment\temp\JSP1_0\default_app\_try_xjsp_debug_jspsrc_988535311.java:135: Undefined variable or class name: jspstr
for (int j=0; j<jspstr.length; j++);
^
C:\Program Files\IBM\VisualAge for Java\ide\project_resources\IBM WebSphere Test Environment\temp\JSP1_0\default_app\_try_xjsp_debug_jspsrc_988535311.java:136: Undefined variable: jspstr
out.print ("\"" + jspstr[j] + "\"" + (j<(jspstr.length-1)?",":""));
^
C:\Program Files\IBM\VisualAge for Java\ide\project_resources\IBM WebSphere Test Environment\temp\JSP1_0\default_app\_try_xjsp_debug_jspsrc_988535311.java:136: Undefined variable: j
out.print ("\"" + jspstr[j] + "\"" + (j<(jspstr.length-1)?",":""));
^
C:\Program Files\IBM\VisualAge for Java\ide\project_resources\IBM WebSphere Test Environment\temp\JSP1_0\default_app\_try_xjsp_debug_jspsrc_988535311.java:136: Undefined variable: j
out.print ("\"" + jspstr[j] + "\"" + (j<(jspstr.length-1)?",":""));
^
C:\Program Files\IBM\VisualAge for Java\ide\project_resources\IBM WebSphere Test Environment\temp\JSP1_0\default_app\_try_xjsp_debug_jspsrc_988535311.java:136: Undefined variable or class name: jspstr
out.print ("\"" + jspstr[j] + "\"" + (j<(jspstr.length-1)?",":""));
^
5 errors
Thanks,
-Priya -
Query in passing value to a function module
Hi All ,
I have a small query in the below code about the way i have passed value into a function module :
CALL FUNCTION 'AUTHORITY_CHECK'
EXPORTING
USER = SY-UNAME
OBJECT = 'E_INVOICE'
FIELD1 = 'BEGRU'
VALUE1 = ' '
FIELD2 = 'BUKRS'
VALUE2 = '$BUKRS'
FIELD3 = 'ISU_ACTIVT'
VALUE3 = '1,2,5,6'
FIELD4 = 'VKTYP_KK'
VALUE4 = ' '
EXCEPTIONS
USER_DONT_EXIST = 1
USER_IS_AUTHORIZED = 2
USER_NOT_AUTHORIZED = 3
USER_IS_LOCKED = 4
OTHERS = 5
IF SY-SUBRC <> 0.
MESSAGE 'User doesnt have sufficient authorizations' TYPE 'E'.
EXIT.
The query is on the field VALUE3 = '1,2,5,6' , is the format correct. If this is not right could someone please suggest the correct approach.
thanksHi Balaji,
as that is parameter you can use at a time only one value..
if you check in that FM we have other parameters VALUE1 to VALUE10..
why don't you use those...
Thanks! -
How to pass values from one function to another
Hi,
I am a middle school teacher and a newbie in Flash Actionscript. I am trying to create a countdown timer for use in my class during tests. The start and pause functions work as required, but not the pause button. When I click on the pause button, the timer is reset to 0:00:00. Please help. Here is the code I had written so far:
var Subject1timeLeftHr;
var Subject1timeLeftMin;
var Subject1timeLeftSec;
Subject1start_btn._visible = true;
Subject1pause_btn._visible = false;
Subject1rotor_mc.gotoAndStop(1);
Subject1rotor_mc._visible = false;
Subject1durationHr_txt.text = "0";
Subject1durationMin_txt.text = "00";
Subject1durationSec_txt.text = "00";
Selection.setFocus(Subject1durationHr_txt);
function SubjectdurationHr(SubjectxdurationHr_txt, SubjectxdurationMin_txt)
if (SubjectxdurationHr_txt.length == 1)
Selection.setFocus(SubjectxdurationMin_txt);
function SubjectdurationMin(SubjectxdurationMin_txt, SubjectxdurationSec_txt)
if (SubjectxdurationMin_txt.length == 2)
Selection.setFocus(SubjectxdurationSec_txt);
function SubjectdurationSec(SubjectxdurationSec_txt, SubjectxdurationHr_txt)
if (SubjectxdurationSec_txt.length == 2)
Selection.setFocus(SubjectxdurationHr_txt);
Subject1durationHr_txt.onChanged = function()
SubjectdurationHr(Subject1durationHr_txt,Subject1durationMin_txt);
Subject1durationMin_txt.onChanged = function()
SubjectdurationMin(Subject1durationMin_txt,Subject1durationSec_txt);
Subject1durationSec_txt.onChanged = function()
SubjectdurationSec(Subject1durationSec_txt,Subject1durationHr_txt);
function startcountdown(SubjectxdurationLeft, SubjectxdurationHr, SubjectxdurationHr_txt, SubjectxdurationMin, SubjectxdurationMin_txt, SubjectxdurationSec, SubjectxdurationSec_txt, Subjectxduration, SubjectxstartTime, SubjectxendTime, Subjectxtimer_mc, Subjectxpause_btn, Subjectxstart_btn, Subjectxrotor_mc, SubjectxtimeLeft, SubjectxtimeLeftHr, SubjectxtimeLeftMin, SubjectxtimeLeftSec, SubjectxtimeLeftHr_txt, SubjectxtimeLeftMin_txt, SubjectxtimeLeftSec_txt)
delete SubjectxdurationLeft;
delete SubjectxdurationHr;
delete SubjectxdurationMin;
delete SubjectxdurationSec;
delete Subjectxduration;
delete SubjectxdurationHr_txt.text;
delete SubjectxdurationMin_txt.text;
delete SubjectxdurationSec_txt.text;
SubjectxstartTime = getTimer();
Subjectxtimer_mc.onEnterFrame = function()
if (SubjectxdurationHr_txt.text == Nan || SubjectxdurationMin_txt.text == Nan || SubjectxdurationSec_txt.text == Nan)
else
SubjectxdurationHr = 60 * 60 * 1000 * Number(SubjectxdurationHr_txt.text);
SubjectxdurationMin = 60 * 1000 * Number(SubjectxdurationMin_txt.text);
SubjectxdurationSec = 1000 * Number(SubjectxdurationSec_txt.text);
Subjectxduration = SubjectxdurationHr + SubjectxdurationMin + SubjectxdurationSec;
SubjectxendTime = SubjectxstartTime + Subjectxduration;
SubjectxdurationLeft = SubjectxendTime - getTimer();
if (SubjectxdurationLeft > 0)
SubjectxdurationHr_txt._visible = false;
SubjectxdurationMin_txt._visible = false;
SubjectxdurationSec_txt._visible = false;
Subjectxpause_btn._visible = true;
Subjectxstart_btn._visible = false;
Subjectxrotor_mc._visible = true;
Subjectxrotor_mc.play();
SubjectxtimeLeft = SubjectxdurationLeft / (1000 * 60 * 60);
SubjectxtimeLeftHr = Math.floor(SubjectxtimeLeft);
SubjectxtimeLeftMin = Math.floor((SubjectxtimeLeft - SubjectxtimeLeftHr) * 60);
SubjectxtimeLeftSec = Math.floor(((SubjectxtimeLeft - SubjectxtimeLeftHr) * 60 - SubjectxtimeLeftMin) * 60);
SubjectxtimeLeftHr_txt.text = String(SubjectxtimeLeftHr);
if (SubjectxtimeLeftHr_txt.length < 1)
SubjectxtimeLeftHr_txt.text = "0" + SubjectxtimeLeftHr_txt.text;
SubjectxtimeLeftMin_txt.text = String(SubjectxtimeLeftMin);
if (SubjectxtimeLeftMin_txt.length < 2)
SubjectxtimeLeftMin_txt.text = "0" + SubjectxtimeLeftMin_txt.text;
SubjectxtimeLeftSec_txt.text = String(SubjectxtimeLeftSec);
if (SubjectxtimeLeftSec_txt.length < 2)
SubjectxtimeLeftSec_txt.text = "0" + SubjectxtimeLeftSec_txt.text;
else
delete Subjectxtimer_mc.onEnterFrame;
SubjectxtimeLeftHr_txt.text = "";
SubjectxtimeLeftMin_txt.text = "";
SubjectxtimeLeftSec_txt.text = "";
SubjectxdurationHr_txt._visible = true;
SubjectxdurationMin_txt._visible = true;
SubjectxdurationSec_txt._visible = true;
Subjectxrotor_mc.gotoAndStop(1);
Subjectxrotor_mc._visible = false;
SubjectxdurationHr_txt.text = "0";
SubjectxdurationMin_txt.text = "00";
SubjectxdurationSec_txt.text = "00";
Subjectxpause_btn._visible = false;
Subjectxstart_btn._visible = true;
Selection.setFocus(SubjectxdurationHr_txt);
function pausecountdown(SubjectxdurationHr_txt, SubjectxtimeLeftHr, SubjectxdurationMin_txt, SubjectxtimeLeftMin, SubjectxdurationSec_txt, SubjectxtimeLeftSec, Subjectxstart_btn, Subjectxpause_btn, Subjectxrotor_mc)
delete Subjectxtimer_mc.onEnterFrame;
SubjectxdurationHr_txt.text = String(SubjectxtimeLeftHr);
SubjectxdurationMin_txt.text = String(SubjectxtimeLeftMin);
SubjectxdurationSec_txt.text = String(SubjectxtimeLeftSec);
Subjectxstart_btn._visible = true;
Subjectxpause_btn._visible = false;
Subjectxrotor_mc.stop();
Subject1pause_btn.onRelease = function()
pausecountdown(Subject1durationHr_txt,Subject1timeLeftHr,Subject1durationMin_txt,Subject1t imeLeftMin,Subject1durationSec_txt,Subject1timeLeftSec,Subject1start_btn,Subject1pause_btn ,Subject1rotor_mc);
Subject1start_btn.onRelease = function()
startcountdown(Subject1durationLeft,Subject1durationHr,Subject1durationHr_txt,Subject1dura tionMin,Subject1durationMin_txt,Subject1durationSec,Subject1durationSec_txt,Subject1durati on,Subject1startTime,Subject1endTime,Subject1timer_mc,Subject1pause_btn,Subject1start_btn, Subject1rotor_mc,Subject1timeLeft,Subject1timeLeftHr,Subject1timeLeftMin,Subject1timeLeftS ec,Subject1timeLeftHr_txt,Subject1timeLeftMin_txt,Subject1timeLeftSec_txt);
Subject1cancel_btn.onRelease = function()
Subject1timeLeftHr_txt.text = "";
Subject1timeLeftMin_txt.text = "";
Subject1timeLeftSec_txt.text = "";
Subject1durationHr_txt._visible = true;
Subject1durationMin_txt._visible = true;
Subject1durationSec_txt._visible = true;
Subject1durationHr_txt.text = "0";
Subject1durationMin_txt.text = "00";
Subject1durationSec_txt.text = "00";
Subject1timeLeftHr_txt._visible = true;
Subject1timeLeftMin_txt._visible = true;
Subject1timeLeftSec_txt._visible = true;
Subject1pause_btn._visible = false;
Subject1start_btn._visible = true;
Subject1rotor_mc._visible = false;
Subject1rotor_mc.gotoAndStop(1);
delete Subject1timer_mc.onEnterFrame;
delete Subject1durationLeft;
delete Subject1duration;
delete Subject1durationHr_txt.text;
delete Subject1durationMin_txt.text;
delete Subject1durationSec_txt.text;I think you need to spend some time reducing your code to practical levels. You seem to be passing everything in the book to every function and I would guess that probably none of it is necessary. If you declared those variables at the beginning, then you don't need to pass them into any function because they are gobally available to any of the code/functions that follows them. Similarly, if you have textfields on the stage, you do not need to pass those into any functions for the same reason.
I see you making overuse of "delete" (and possibly errant use as well). Probably the only thing you might want/need to use is...
delete Subjectxtimer_mc.onEnterFrame;
Which stops the enterframe activity from firing off, which I will guess is being used to update the textfields that indicate the time.
And that conditional that uses == Nan isn't likely to do anything except wonder what an Nan is. Textfields hold strings, which are quoted. SO unless you have a variable named Nan somewhere that has a String value assigned to it, that conditional won't be doing anything for you. You probably won't need it at all if you get this working properly.
Maybe you are looking for
-
Hi all, with 10 g database, 11i and os is AIX. Getting error with form trace something like Dump of memory from 0x0FFFFFFFFFFAA6D0 to 0x0FFFFFFFFFFAA6E6 FFFFFFFFFFAA6D0 FEFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] FFFFFFFFFFAA6E0 FFFFFFFF F
-
Can't re-install Panther 10.3
Hi, My blue G4 has been acting up latel so I want to completely re-install 10.3. I am running 10.3.9 right now and when I try to install my 10.3 disks, I get the message I ccannot install Mac OS 10.3 on this volume. A newer OS is installed. I have ev
-
Core Center Interface wont run
I've been looking in the forum for someone else with a similar problem but everyone seems to get an error message or atleast get it runnning in one way or another. My problem is that when i start corecenter.exe the only thing that starts is corecente
-
Error Message when I use Flash websit
I am on XP and have Flash 8 installed. Yet as I rollover navigation on site I see this box come up: Click to Activate and Use this control or Press Spacebar to activate and use this control. In some case a black ouline goes around an entire map or na
-
Hi, Can MARS discover Cisco GSS.