IT Community - Software Programming, Web Development and Technical Support

java

This is a discussion on java within the Java Programming forums, part of the Software Development category; How to convert numbers to strings using JavaScript? You can prepend the number with an empty string var mystring = "&...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Software Development > Java Programming

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 03-19-2008, 11:45 PM
sureshbb sureshbb is offline
D-Web Sr.Programmer
 
Join Date: Aug 2007
Posts: 149
sureshbb is on a distinguished road
Default java

How to convert numbers to strings using JavaScript?

You can prepend the number with an empty string
var mystring = ""+myinteger;
or
var mystring = myinteger.toString();
You can specify a base for the conversion,
var myinteger = 14;
var mystring = myinteger.toString(16);

mystring will be "e".
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 03-19-2008, 11:46 PM
sureshbb sureshbb is offline
D-Web Sr.Programmer
 
Join Date: Aug 2007
Posts: 149
sureshbb is on a distinguished road
Default Re: java

How to change style on an element?

Between CSS and javascript is a weird symmetry. CSS style rules are layed on top of the DOM. The CSS property names like "font-weight" are transliterated into "myElement.style.fontWeight". The class of an element can be swapped out. For example:
document.getElementById("myText").style.color = "green";
document.getElementById("myText").style.fontSize = "20";
-or-
document.getElementById("myText").className = "regular";
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 03-19-2008, 11:47 PM
sureshbb sureshbb is offline
D-Web Sr.Programmer
 
Join Date: Aug 2007
Posts: 149
sureshbb is on a distinguished road
Default Re: java

How to have the status line update when the mouse goes over a link (The support of the status line is sporadic)?

<a href="javascript.shtml"
onmouseover="window.status='Hi There!';return true"
onmouseout="window.status='';return true">Look at the Status bar</a>

Look at the Status bar as your cursor goes over the link.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 03-19-2008, 11:52 PM
sureshbb sureshbb is offline
D-Web Sr.Programmer
 
Join Date: Aug 2007
Posts: 149
sureshbb is on a distinguished road
Default Re: java

How to write messages to the screen without using "document.write()" ?

Changing the contents of an element is a much better solution. When the method showStatus is invoked it will change the content of the span.
...
function showStatus(message) {
var element = document.getElementById("mystatus");
element.textContent = message; //for Firefox
element.innerHTML = message; //for IE (why can't we all just get along?)
return true;
}
...
<span id="mystatus">Test. </span>
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 03-19-2008, 11:53 PM
sureshbb sureshbb is offline
D-Web Sr.Programmer
 
Join Date: Aug 2007
Posts: 149
sureshbb is on a distinguished road
Default Re: java

What is the difference between undefined value and null value?

1 Undefined value cannot be explicitly stated that is there is no keyword called undefined whereas null value has keyword called null

2 Typeof undefined variable or property returns undefined whereas typeof null value returns object
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
integerate Java Beans in java application saravanan Java Programming 1 03-26-2008 01:22 AM


All times are GMT -7. The time now is 11:55 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0