function getstarttime() { var start = new Date(); var timestamp = start.getHours()+'.'+start.getMinutes()+'.'+start.getSeconds()+'.'+start.getMilliseconds(); return timestamp; }
function getendtime() { var end = new Date(); var timestamp = end.getHours()+'.'+end.getMinutes()+'.'+end.getSeconds()+'.'+end.getMilliseconds(); return timestamp; }
I want to write function writelog which will write the above starttime and endtime information in the frame or popup window .
Then in my html page i want to use this function like this...
var st = starttime() alert("click ok alertbox1"); var et = endtime() writelog(st,et);
I want to generate frame or popup showing startime, endtime using this writelog(st,et) function.
var st1 = starttime(); alert("click ok alertbox2"); var et1 = endtime(); writelog(st1,et1); i want to append this starttime end time in the same window or frame below the above starttime endtimefor alertbox1.
i am facing problem here.i donot know how to append the data in the frame or popup window.
can somebody help me in writing the function writelog(startime,endtime) this function should be generi like startime and endtime functions and can be used anywhere in html page to write starttime and endtime.
i donot know how to append the data in the frame or popup window. using your program i can write the data in the frame once.then next time i call the same function the previous data is overwritten by new data somthing like this
starttime:13.23.21.11 endtime:13.23.21.12
but i want to append my o/p after each call like this
starttime:13.23.21.11 endtime:13.23.21.12
starttime:13.23.31.41 endtime:13.23.31.42
starttime:13.24.21.11 endtime:13.24.21.12
on making function call the data is appended ..but using code u have provided the o/p is overwritten
function getstarttime() { var start = new Date(); var timestamp = start.getHours()+'.'+start.getMinutes()+'.'+start.getSeconds()+'.'+start.getMilliseconds(); return timestamp; }
function getendtime() { var end = new Date(); var timestamp = end.getHours()+'.'+end.getMinutes()+'.'+end.getSeconds()+'.'+end.getMilliseconds(); return timestamp; }
function writelog(str,end) { document.write("<FRAMESET cols=70%,30%>") document.write("<FRAME SRC=1.html name=left_frame>") document.write(" <FRAME SRC=2.html name=right_frame> ") document.write("</FRAMESET>") var txt =str+'<br>'+end ; top.frames["right_frame"].document.getElementsByTagName('body')[0].innerHTML=txt;
} in 2.html i am writing the o/p to html page ..bot i am getting error top.frames["right_frame"].document.getElementsByTagName STATING THAT its not a object or null how shud i go about this?
function calculate() { var time = getstarttime() alert("click ok to continue"); var end = getendtime(); writelog(time,end); } </script> </head> <body bgcolor = "pink"> <script> calculate(); </script> </body> </html>
file trail.js function getstarttime() { var start = new Date(); var timestamp = start.getHours()+'.'+start.getMinutes()+'.'+start.getSeconds()+'.'+start.getMilliseconds(); return timestamp; }
function getendtime() { var end = new Date(); var timestamp = end.getHours()+'.'+end.getMinutes()+'.'+end.getSeconds()+'.'+end.getMilliseconds(); return timestamp; }
function writelog(str,end) { document.write('<FRAMESET cols="70%,30%">') document.write('<FRAME SRC="1.html" name="left_frame">') document.write('<FRAME SRC="2.html" name="right_frame">') document.write('</FRAMESET>') var txt =str+'<br>'+end ; top.frames["right_frame"].document.getElementsByTagName('body')[0].innerHTML=txt; }
file 2.html <HTML> <HEAD>
</HEAD> <BODY> <script language="JavaScript/text"> var str = '' var etr = '' document.write("the starttime is"+str); document.write("the end time is"+etr); </script> </body> </html>
the error i am getting is top.frames["right_frame"].document.getElementsByTagName is null or not a object...
i need to have the separate window...frame...popup.... i want to display the o/p there. actually i want generic functions. now i can put this function as probes and get the information. Means i want to put getstarttime() before any element ..getendtime() after the element and then use this function writelog() to diaplay data..i should be able to call this function anywhere in my page and create new page showing outut.
function output(url,begin ,end) //i am passing three parameters to this function { now here i want to a new window(may be frame or popup) and i want to write these parameters to this window when first function call is made. } now whenever next function calls are made to this function the function should be able to write in the same window opened by it in first call ..below the previous written data.
how should i do that? please explain ...
thank you. gajanan for popup window i have wrtitten this ...plezzz explain how to write o/pin this popup? var newwindow = '';
function popitup(url,begin,end) { if (!newwindow.closed && newwindow.location) { newwindow.location.href = url; } else { newwindow=window.open(url,'name','height=400,width=350'); if (!newwindow.opener) newwindow.opener = self; } if (window.focus) {newwindow.focus()} return false; }
Don't get me started about those stupid light bulbs.