Jump to content

Namal

Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by Namal

  1. Namal

    Data type

    Thank you very much for your reply. My function is working now.
  2. Namal

    Data type

    In my Html document, I created 3 input boxes. Those (ID s)are txt1txt2txttotIn my javascript document, I have 2 variables. Those arevar tmp;var total;I created a function like this....(javascript)function totval(){tmp= document.getElementById('txt1').value + document.getElementById('txt2').value;total=tmp;document.getElementById('txttot').value= tmp;}---------------------------------------------Html document<input type="text" id="txt1" ><input type="text" id="txt2" ><input type="text" id="txttot"><input type="button" onClick="totval()" value="Total"/> This is my problem.... In running mode, I will insert 25 and 50 to 'txt1' and 'txt2' textboxes.Accordion to my function, the value of 'tmp' should be= 75.but the value was display tmp= 2550How to get my expected value??
  3. Namal

    variables

    There are 3 variables in my Javascript document.Those are:value1, value2, value3.I created a function call mytestfuncion and I included following:function mytestfunction(){value1=10;value2=20;value3=value1+value2;}my expected result is value3= 30. but I received result is: 1020Then pls explain how can get my expected result.
  4. There is a function call "myvalue()" in my external javascript file. (tst.js)There are button call " Test" and input textbox call (ID) "txttotal" in my HTML file.I want to do following:Click on the "Test" button, The "txttotal" value will be "10"How can I do that?... Please explain that soon.
  5. There is a function call "myvalue()" in my external javascript file. (tst.js)There are button call " Test" and input textbox call "txttotal" in my HTML file.I want to do following:Click on the "Test" button, The "txttotal" value will be "10"How can I do that... Please explain that soon.
  6. I used the external Javascipt file to my Html document. But it is not working. Pls explain what is the mistake of my script.This is the Javascript file<script type="text/javascript"> var d = new date() var time = d.getHours() if (time<10) { document.write ("<b>Suba Udesanak</b>") } else if (time>=10 && time<16) { document.write ("<b> Suba Dawask </b>") } else { document.write ("<b>Hello All!</b>") alert ("Hello All) }</script>And this is the Html document.<html><head> <title> My fIrst JavaScript Test</title> <link rel= "stylesheet" type="text/css" href="jsstyle1.css"/></head> <body> <script src="testjs.js"></script> <h1>JS & CSS Practical Test Site</h1> <p>This is a simple test site. This is a simple test site. This is a simple test site. This is a simple test site. This is a simple test site. This is a simple test site. This is a simple test site. This is a simple test site. This is a simple test site. This is a simple test site. This is a simple test site. This is a simple test site. This is a simple test site. This is a simple test site. This is a simple test site. This is a simple test site. This is a simple test site. This is a simple test site. This is a simple test site. This is a simple test site. </p>//Therea are another more tags in the body section.. but I think those are not necessary for this.</body></html>Pls help me to solve my problem.
  7. Please explain how to adjust the size of a webpage in HTML document.
×
×
  • Create New...