Total members 11893 |It is currently Tue Nov 05, 2024 5:27 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





hello world i am very new to javascript and i need some help in it What is the statement in JavaScript that puts the words The grade is and the result of a calculation stored in mygrade up on the screen? this one of questions i cant answer.. somebody help me! please ty




Author:
Newbie
User avatar Posts: 4
Have thanks: 0 time

You can write on screen using document.write function
Code:

<html>
<
body>
<
script>

document.write(' hello');
</script>
</body>
</html>


You can print what is in variable

Code:

<html>
<
body>
<
script>
var sum=0;
var x=5;
var y=3;
sum=x+y;
document.write(sum);
</script>
</body>
</html>


You can print string : 


Code:

<html>
<
body>
<
script>
var 
description="x+y= ";
var sum=0;
var x=5;
var y=3;
sum=x+y;
document.write(description+sum);
</script>
</body>
</html>



_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time

For this message the author DrRakha has received gratitude : themadruski

how about this one : Which loop structure can be set up so that you may or may not enter the loop code?>/p>


Author:
Newbie
User avatar Posts: 4
Have thanks: 0 time

loop ?
like this
Code:

<html>
<
body>
<
script>
 
var 
sum=10;
  for(var 
i=0;i<sum;i++){
    
document.write('Iteration number '+i+'<br/>');
  }

</script>
</body>
</html>


_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time

msi_333 wrote:
loop ?
like this
Code:

<html>
<
body>
<
script>
 
var sum
=10;
  for(var i=0;i<sum;i++){
    document.write('Iteration number '+i+'<br/>');
  }

</script>
</body>
</html>



Author:
Newbie
User avatar Posts: 4
Have thanks: 0 time

@themadruski
you quote my reply ! is your problem solved ?

_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time

msi_333 wrote:
@themadruski
you quote my reply ! is your problem solved ?
yes and no but thanks anyway bro.


Author:
Newbie
User avatar Posts: 4
Have thanks: 0 time

:( :(

_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 8 posts ] 

  Related Posts  to : i need help in javascript
 javascript help with BMI     -  
 When to use javascript?     -  
 using javascript     -  
 Javascript     -  
 need help in javascript     -  
 need help with javascript     -  
 what is javascript ?     -  
 JavaScript     -  
 new window using javascript     -  
 validation using JavaScript     -  









Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com