now.getMilliseconds(); - seconds

Here is a set of code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="www.w3.org/1999/xhtml" xml:lang="en">
<title>Lots of Time</title>
<body>
<h1>Times</h1>
<script "type/javascript">
now = new Date();
localtime = now.toString();
utctime = now.toGMTString();
hours = now.getHours();
mins = now.getMinutes();
secs = now.getSeconds();
milli = now.getMilliseconds();
document.write("<h2>Local time:</h2> " + localtime + "<br/>");
document.write("<h2>UTC time</h2> " + utctime);
document.write("<h1>");
document.write(hours + ":" + mins + ":" + secs + ":" milli);
document.write("</h1>");
document.write("<h1>");
document.write(hours + ":" + mins + ":" + secs + ":" milli);
document.write("</h1>");
</script>
</body>
</html>
Everything worked fine until I added the line with the getMilliseconds();
Any help would be much appreciated.
Sincerely,
Erin

Add a plus sign so it looks like:
document.write(hours + ":" + mins + ":" + secs + ":" + milli);

change
document.write(hours + ":" + mins + ":" + secs + ":" milli);
to
document.write(hours + ":" + mins + ":" + secs + ":" + milli);

Related

how to make each json data to an separate element

** i want to display the theaters like a child node element of the demo node and after i want to trigger the onclick event for other function...**
using only javascript
let VizagData = '{"theater":[' +
'{"TheaterName":"Sangam","Quality":"4K","sound":"DolbyAtmos" },' +
'{"TheaterName":"Sarat","Quality":"4K","sound":"DolbyAtmos" },'+
'{"TheaterName":"Melody","Quality":"4K","sound":"DolbyAtmos"}]}';
let VZMData = '{"theater":[' +
'{"TheaterName":"Srikanya","Quality":"4K","sound":"DolbyAtmos" },' +
'{"TheaterName":"kameswari","Quality":"4K","sound":"DolbyAtmos" },'+
'{"TheaterName":"IMAX","Quality":"4K","sound":"DolbyAtmos"}]}';
function search() {
document.getElementById('th').innerHTML = myfunction();
function myfunction() {
var value = document.getElementById('ct').value;
var th1 = document.createElement('div');
document.getElementById('th').appendChild(th1);
th1.innerHTML = "theaters in " + value;
return th1.innerHTML;
}
}
function data() {
var index = document.getElementById('ct');
var demo = document.getElementById("demo");
if(index.value === "vizag"){
const obj = JSON.parse(VizagData);
demo.innerHTML = obj.theater[0].TheaterName + " : " + obj.theater[0].Quality + "," + obj.theater[0].sound + "<br>" + obj.theater[1].TheaterName + " : " + obj.theater[1].Quality + "," + obj.theater[1].sound + "<br>" + obj.theater[2].TheaterName + " : " + obj.theater[2].Quality + "," + obj.theater[2].sound;
}
else {
const obj = JSON.parse(VZMData);
demo.innerHTML = obj.theater[0].TheaterName + " : " + obj.theater[0].Quality + "," + obj.theater[0].sound + "<br>" + obj.theater[1].TheaterName + " : " + obj.theater[1].Quality + "," + obj.theater[1].sound + "<br>" + obj.theater[2].TheaterName + " : " + obj.theater[2].Quality + "," + obj.theater[2].sound;
}
}
var go = document.getElementById('go');
addEventListener('click', search);
addEventListener('click', data);
<select id="ct">
<option value="vizianagaram">vizianagaram</option>
<option value="vizag">vizag</option>
</select>
<button id="go">GO</button>
<div class="th" id="th"></div>
<div id="demo"></div>

how do re-size a HTML <object> tag when the content in it is dynamic

I have some jQuery and HTML that renders an OBJECT tag with a default html page then repopulates the OBJECT on a button click when the new page ,which is dynamic, is done rendering I'd like to resize the object to be 100% the size of the rendered page is that possible ?
code following
$(document).ready(function() {
$('#sq').click(function() {
var actualYear = $('#ay').val() ;
var actualTerm = $('#tc').val();
if (actualTerm == '01')
{
actualYear = Number($('#ay').val()) + 1;
}
var actualTC = actualYear + actualTerm; + $('#smcSel').val() + "&ccc=" + $('#cccSel').val() + "&ac=" + $('#acSel').val() + "&cs=" + $('#csSel').val() + "&cl=" + $('#clSel').val() + "&smd=" + $('#smdSel').val() + "&sm=" + $('#smSel').val() + "&sl=" + $('#slSel').val() + "&ib=" + $('#IBID').val() + "&sb=" + $('#SBID').val() + "&ay=" + $('#ay').val() + "&tc=" + $('#ay').val() + $('#tc').val() + "&tca="+ actualTC + "&mes=" + $('#mes').val() + "&pr=" + $('#pr').val() + "&sr=" + $('#sr').val() + "&tr=" + $('#tr').val() + "&col=" + $('#col').val() + "&mc=";
var urlis = window.location.protocol + "//" + window.location.hostname + "/SASStoredProcess/do?_action=execute,nobanner,newwindow&_program=%2FTABBS%2FuQuery%2Ftbir11052&smc=" + $('#smcSel').val() + "&ccc=" + $('#cccSel').val() + "&ac=" + $('#acSel').val() + "&cs=" + $('#csSel').val() + "&cl=" + $('#clSel').val() + "&smd=" + $('#smdSel').val() + "&sm=" + $('#smSel').val() + "&sl=" + $('#slSel').val() + "&ib=" + $('#IBID').val() + "&sb=" + $('#SBID').val() + "&ay=" + $('#ay').val() + "&tc=" + $('#ay').val() + $('#tc').val() + "&tca="+ actualTC + "&mes=" + $('#mes').val() + "&pr=" + $('#pr').val() + "&sr=" + $('#sr').val() + "&tr=" + $('#tr').val() + "&col=" + $('#col').val() + "&mc=";
document.getElementById("contentarea").setAttribute('data', urlis);
});
});
<div id="result">
<object type="text/html" data="./contentarea.html" style="float:left;width:100%;height:100%;" id=contentarea></object>
</div>
Add this style style="float:left;width:100%;height:100%;" to <div id="result">.
In few browsers, % won't support. So better to specify with pixels (height: 500px; width: 900px;)

GmailApp.sendEmail() syntax for multiple options?

I want to send emails with multiple hyperlinked text, line breaks and bolding. In addition to the .sendEmail() documentation, I found this question and answer, but I'm still confused. Here's what I'm doing:
function emailTest() {
var Link1 = "https://sites.google.com/a/****/item-shop" ;
var Link2 = "https://sites.google.com/a/****/leader-board" ;
var name = "Adam";
var message = "Congratulations " + name.bold() + "!" + '\n' + '\n' + "check out this cool " + Link1 + '\n' + '\n' +
"and this cool " + Link2 + '\n' + '\n' +
"Keep up the good work!" + '\n' + "Mr. S.";
GmailApp.sendEmail ('fakename#gmail.com', "Congratulations!", message,
{htmlBody: message.replace(Link1, 'Item Shop'),
htmlBody: message.replace(Link2, 'LeaderBoard')})
}
Here's the result:
bolding worked, and only 1 of the links, the line breaks did not happen.
any guidance is appreciated!
Have you tried starting with the http:// protocol?
Try this:
var link = "http://www.google.com";
var message = "Congratulations " + name[i] + "!" + '\n' + '\n' +
"check out this cool " + link + + '\n' + '\n' +
"Keep up the good work!" + '\n' + "Mr. S."
GmailApp.sendEmail(fakename#gmail.com, "Congratulations!", message,
{htmlBody: message.replace('link', 'Website')})
EDIT:
Try sepperating the links with the email send function, which also helps making it a little more readable. Try this (btw im not that familliar with google script but i am pretty sure this should work):
function emailTest() {
var Link1 = "https://sites.google.com/a/****/item-shop" ;
var Link2 = "https://sites.google.com/a/****/leader-board" ;
var name = "Adam";
var message = "Congratulations " + name.bold() + "!" + '<br/>' + '<br/>' + "check out this cool " + Link1 + '<br/>' + '<br/>' +
"and this cool " + Link2 + '<br/>' + '<br/>' +
"Keep up the good work!" + '<br/>' + "Mr. S.";
message = message.replace(Link1, 'Item Shop');
message = message.replace(Link2, 'LeaderBoard');
GmailApp.sendEmail ('fakename#gmail.com', "Congratulations!", message, {htmlBody: message});
}

Grails JSON from controller to GSP formatting html tag

I am trying to send the following JSON from my controller to the GSP:
[
"message": errorList + '<br/>' + '<br/>' +
'Rows loaded: ' + rows + '<br/>' +
'<img src="${resource(dir: ''images'', file: ''twc-logo-002.png'')}" alt="logo" />'
+ 'Errors: ' + errors + '<br/>' +
'Yellow Issues: ' + yellowFlags + '<br/>' +
'Red Issues: ' + redFlags
]
I am having a hard time with compiler errors on the line containing the image tag. I don't think I am escaping the inner quotes correctly. Any advice? Thanks.
[
"message": errorList + '<br/>' + '<br/>' +
'Rows loaded: ' + rows + '<br/> \'<img src=\"${resource(dir: \'images\',file: \'twc-logo-002.png\')}\" alt=\"logo\" />'
+ 'Errors: ' + errors + '<br/>' +
'Yellow Issues: ' + yellowFlags + '<br/>' +
'Red Issues: ' + redFlags
]

How to add spaces HTML output

In the below code I want to create spaces when it is executed that is I want to see spaces
"HSC&nbsp" + txthsc.Text + "&nbspHSC" + txthscclg.Text + "
between HSC and txthsc tag so please help..
string strBody = "" +
"" +
"<div>Your name is: <b>" + txtaddress.Text + "</b></div>" +
"<div> your Gender:<b>"+txtgender.Text+"</b></div>"+
"<div> your skills:<b>" + txtskills.Text + "</b></div>" +
"<div> your experience:<b>" + txtexp.Text+ "</b></div>" +
"<div> your phno:<b>" + txtphno.Text + "</b></div>" +
"<table width=\"100%\" style=\"background-color:#cfcfcf;\"><tr><td>1st Cell body data</td><td>2nd cell body data</td></tr></table>" +
"<table width=\"500%\" style=\"background-color:#cfcfcf;\"><tr><td>BBA<b>&nbsp" + txtbba.Text + "&nbsp</td><td>HSC<b>" + txtbbaclg.Text + "</td></tr></table>" +
**"<table width=\"500%\" style=\"background-color:#cfcfcf;\"><tr><td>HSC<b>&nbsp" + txthsc.Text + "&nbsp</td><td>HSC<b>" + txthscclg.Text + "</td>**</tr></table>" +
"<table width=\"500%\" style=\"background-color:#cfcfcf;\"><tr><td>SSC<b>&nbsp" + txtssc.Text + "&nbsp</td><td>HSC<b>" + txtsscclg.Text + "</td></tr></table>" +
"Resume document generated successfully."+
"</body>" +
"</html>";
i think you are missing ; from &nbsp - Correct entity is