|
Since it's the Google API then maybe Google[^] would have the answer.
|
|
|
|
|
i have one issue
whenever clicking the radio button the open document should be print by using javascript. if any one know please give me the code.
|
|
|
|
|
The standard way to print a web page is to use window.print(); in the trigger you want to fire the print. Note that it doesn't directly print the page - it shows the print dialog instead, and lets the user choose whether or not they want to print (along with providing print options).
|
|
|
|
|
Could you please provide some peace of code for Print Dialog.
|
|
|
|
|
I have.
window.print(); That shows the printer dialog.
|
|
|
|
|
But iz only txts, I demand the codez.
You must give me the codez ...
"With sufficient thrust, pigs fly just fine."
Ross Callon, The Twelve Networking Truths, RFC1925
|
|
|
|
|
If you'd said Urgntz, I'd have given you the cdz, but you didn't so I didn't.
|
|
|
|
|
Hi All,
I'm trying out some javascript functions and XML Data Island that I was told should work but they do not. The following is the error message that I get when I tried to display my web page in Windows 7:
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; MAAU; .NET4.0C)
Timestamp: Wed, 21 Sep 2011 05:19:50 UTC
Message: Invalid character
Line: 16
Char: 53
Code: 0
URI: file:///C:/Users/Tape%20Pra%20Yuda/Desktop/PracticeWeb/SampleXML3.html
Message: Object expected
Line: 1
Char: 1
Code: 0
URI: file:///C:/Users/Tape%20Pra%20Yuda/Desktop/PracticeWeb/SampleXML3.html
I do not understand why data from the XML in the body of my html doc can not be displayed. Below are the html and javascript I'm using. Please take a look and tell me what I've done wrong, thanks in advance for your help.
<pre lang="text">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Contact Info Example1</title>
<script language="javascript" type="text/javascript">
function displayBusinessCardData() {
var xmldata1 = document.getElementById("xmldata1");
var bizCard = xmldata1.getElementsByTagName("BusinessCard")[0];
var name = "Name: " + bizCard.getElementsByTagName("Name")[0].firstChild.data;
var phone1 = "Phone:" + bizCard.getElementsByTagName("phone")[0].firstChild.data;
var phone2 = "Phone:" + bizCard.getElementsByTagName("phone")[1].firstChild.data;
var phone3 = "Phone:" + bizCard.getElementsByTagName("phone")[2].firstChild.data;
var email = "email:" + bizCard.getElementsByTagName("email")[0].firstChild.data;
alert("Contact Information: \n\n\" + name + "\n" + phone1 + "\n" + phone2 + "\n" + phone3 + "\n" + email);
}
</script>
</head>
<body>
<xml id="xmldata1" style="display:none">
<BusinessCard>
<Name> Pac Man</Name>
<phone type="mobile">(444) 123-4568</phone>
<phone type="work">(800) 111-2345</phone>
<phone type="fax">(444) 123-5678</phone>
<email>person1@dev.com</email>
</BusinessCard>
</xml>
<a href = "javascript:displayBusinessCardData()">Show Contact Info</a>
</body >
</html>
</pre>
-- Modified Wednesday, September 21, 2011 2:12 AM
|
|
|
|
|
You have an extra backslash in front of the first closing quote on the alert line - try taking that out.
|
|
|
|
|
Hi, thanks for responding. You're suggestion works.
-- Modified Wednesday, September 21, 2011 4:30 AM
|
|
|
|
|
I use the following code in order to display a fake sending method that lasts 1 second:
<pre lang="Javascript">$("#" + action + "-submit-message").text("sending...");
var startTime = new Date().getTime();
while (new Date().getTime() < startTime + 1000);
$("#" + action + "-submit-message").text("sent!");</pre>
Despite of that, I can see only the "sent!" message in the end of the function, when I expect to see the "sending..." for a second. What can be the problem?
|
|
|
|
|
I guess your while loop is locking out the DOM update while it runs.
Try using a timer instead:
$("#" + action + "-submit-message").text("sending...");
setTimeout(function() {
$("#" + action + "-submit-message").text("sent!");
},1000);
|
|
|
|
|
I have tried something similar to:
function f(){
$("#" + action + "-submit-message").text("sending...");
setTimeout(done(),1000);
}
function done()
{
$("#" + action + "-submit-message").text("sent!");
}
but what I get is the "sending..." message permanently(the "sent!" is never displayed)
|
|
|
|
|
Try removing the () from inside the setTimeout call, like this:
setTimeout(done,1000);
This means you pass the done function to setTimeout to call when the timer runs down, whereas setTimeout(done(),1000); calls done at the start and passes the result to setTimeout to run later, which is not what you want.
|
|
|
|
|
I think it works, but what if I have to pass parameters to a function?
Is there a way to do it?
|
|
|
|
|
|
Hi,
Just inclose the done function in either double or single qouts like so:
setTimeout('done()', 1000);
that way you can even pass parameters in the call to the "done" function.
Good luck,
Morgs
|
|
|
|
|
I have recently been learning JavaScript and just playing around with it. I am a C/C++ programmer from the days of DOS and am now moving into C#.
I love all four of these languages but I am not a web developer so I haven't found any serious use for JavaScript. I use IronPython or PowerShell for any scripting on my machine and this would probably be the only way I would use JavaScript outside of web app development.
What I would like to discuss is the possibility of a JavaScript compiler that produces either native executables or a MSIL assembly.
I haven't found any compilers that actually do this (and I am not saying they don't exist only that I haven't seen any) and I would love to see JavaScript used in this way as it is a very powerful and pretty language (I am a "curly brace" programmer).
The most useful in my opinion would be the "functions as first-class objects" aspect (to quote Douglas Crockford), although Lambda is being introduced in almost every popular imperative language so the benefits would be negligible.
Anybody have an opinion on this? Negative and positive feedback welcome!
|
|
|
|
|
Hi,
Javascript have no external compiler. Javascript is an addon for development with HTML.
Use MS Net or Oracle Java or Adobe Flash for development with pre compiled byte code.
Javascript for Microsoft Internet Explorer see http://msdn.microsoft.com/en-us/library/aa155073.aspx
|
|
|
|
|
This I know. What I am saying is I would like to see someone write a compiler (there already is an interpreter in Windows for scripting) that creates a native executable and/or a MSIL assembly.
I'm talking about writing a JavaScript compiler that allows one to write their desktop applications in JavaScript.
Obviously there are many components in the javaScript library that work exclusively with HTML, others with AJAX. These parts may or may not be desirable and would give a headache to the compiler engineer who was to create this "desktop compiler" for JS.
But there is so much elegance and beauty in the language that I would really like to see "JS++" or "JavaScript#".
Once ported to desktop usage many of the libraries would become obsolete (I would think) and a completely new language would evolve. It would most likely have to be called something else to avoid copyright infringment--just like Microsoft's version called "JScript". Pretty suttle, huh?
This task is far beyond my own capabilities but I've been tinkering and using only a for loop from JavaScript and converting to MSIL (I had an elementary understanding of x86 Assembly on 16-bit machines running DOS and I am probably further away from understanding as I've ever been). Just a brute-force method to see "if i could". I plan on devoting some time to learn about compiler design and obviously I must master JavaScript and understand MSIL completely.
I've digressed; my real purpose of writing this discussion was to discuss possibilities, reasons why it should or *should not* be made.
Basically, I love the language but I am not a web developer or designer. I write desktop windows applications and I would really like to, more as a novelty but nevertheless a useful tool as well, code a desktop app completely in JavaScript.
One more thing, I heard of a couple of languages that took the "good parts" and did away with the "bad" and the buggy and insecure of JavaScript. One was called CoffeeScript (Good Name!) and the others I don't remember. Do these run in the browser as well? They should as the are a subset of the total language.
Please, I'd really like some serious feedback on this. I know it sounds crazy but isn't that what hacking is all about? Pushing things to the limit and beyond? And I don't mean malicious users I'm talking about old school hackers--programmers that made their software do things that they were told was impossible at that time. This is what it is all about for me.
|
|
|
|
|
|
Thank you for the information; I'm quite amazed that I did not run into it during my massive "JavaScript Compiler" Bing campaign. You must be able to link to and utilize the power of the .net assemblies. I think I 'll be experimenting asap. Thanks for the heads up.
|
|
|
|
|
Hi,
to compile javascript into bytecode you nee a runtime machine inside of browsers
and operating system like windows too.
to compile javascript into machine code you need interface of operating system
and browsers.
to write you own browser in use of byte code like java see http://lobobrowser.org/java-browser.jsp
to translate jacascript into other language you must use interface.
html dom and javascript or vbscript .... version of microsoft is Net-Framwork.
opera and Co. translate internal javascript into bytecode.
see http://code.google.com/intl/en/closure/compiler/
translate javascript into java see http://www.mozilla.org/rhino/jsc.html
yep, for The Visual Studio .NET Command Prompt (called JScript.NET and can be compiled to create .exe files)
see http://msdn.microsoft.com/en-us/library/7435xtz6(v=vs.71).aspx
|
|
|
|
|
Hey thanks,
I'm glad I started this discussion because I've been thinking about it for a long time and now I have a lot of solid information to help me get started on a project. It will be done slowly in my scarce spare time I'd like to create a native compiler for JavaScript.
First, I know converting to MSIL or bytecode is the much easier way to go and with all this info iam well on my way. Thanks again and thanks to everyone who responded.
|
|
|
|
|
Hi,
I need some info from you guys.
Can anyone please give me idea how to restrict user not to enter "<" and ">" character in text box and even user not able to paste these characters?
Thanks,
Inder K...
|
|
|
|