ionezation
-
Posts
44 -
Joined
-
Last visited
Posts posted by ionezation
-
-
So nice of you larry thanks for providing such great treasure to learn for me .. One thing larry may i ask you for career path? anywhere in this forum???
-
let me check again ! i dint change the document.getelementbyID(); method at all
var fname = document.getElementById('fname').value;
-
Yes hartleysan, after the script you have submitted it shows this
Employee Added
Name : undefinedundefined // undefined first and last name. They are still undefined
Department : IT // It is changing now
Hire Date : Wed Jan 15 2014 // date is thisIn console it is that
// undefined undefined "accounts" Wed Jan 15 2014 06:22:11 GMT-0800 (Pacific Standard Time)
i have found one error in my code and that was here in :
function init()
{'use strict';var form = document.getElementById('form');form.onsubmit = calculate;}; // end init()window.onload = calculate; // Instead of init; i placed here calculate(); -
Thanks for correction and giving me more knowledge Jaepee and HartleySen.
one mistake i am making everytime is
function init(){ 'use stric'; var theform = document.getElementById('theform'); theform.onsubmit = calculate; }; window.onload = init;
misspelling of Strict [ 'use stric' ], even jaypee dint notced that.
-
In Chapter 7 - Creating Function page number 237. The code in the book has a discrepency that is provided in source code. It took me 30mins to get on the conclusion. The difference was at line
output.textContent = numbers;
Instead it would be output.textContent = message;
Here it is the code
This is in the book at page 237
function setText(elementId,message) { 'use strict'; if ((typeof elementId == 'string') && (typeof message == 'string') ){ var output = $(elementId); if(output.textContent !== undefined) { output.textContent = numbers; } else { output.innerText = numbers; } } // end of if } // end of setText()
This is the working corrected one in source code :
function setText(elementId,message) { 'use strict'; if ((typeof elementId == 'string') && (typeof message == 'string') ){ var output = $(elementId); if(output.textContent !== undefined) { output.textContent = message; } else { output.innerText = message; } } // end of if } // end of setText()
-
no errors at all hartley, I just seeing
name:
department:accounts
Hiring Date : is the current date time.
thats it :x
-
now i have return false; after
output.innerHTML = msg;
return false;}but still not working :s -
one mistake i had that the misspell of 'strict' in Function init();
function init() { 'use stric'; var form = document.getElementById('form'); form.onsubmit = calculate; }; // end init()
-
Yes, even after this it is not working.
When i click add employee it reloads the page but doesn`t update the output field at all.
-
It doesn`t work either hartley ! this is from chapter 6 [complex variable type] on page 212, its about working with array.
Before this example there also one in this book that is also not working it is on page 196 chapter 6 [complex variable type] and it is for working with objects
-
This is my HTML
<form id="form" method="post"> First Name : <input type="text" id="fname" name="fname"> <br> Last Name : <input type="text" id="lname" name="lname"> <br> Department : <select name="department" id="department"> <option value="accounts">Accounts</option> <option value="hr">HR</option> <option value="it">Information Technology</option> <input type="submit" id="submit" value="Add Employee"> <div id="output"></div> </form> </select>
This is my CSS !
function calculate(){ 'use strict'; var fname = document.getElementById('fname').value; var lname = document.getElementById('lname').value; var depart = document.getElementById('department').value; var output = document.getElementById('output'); var employee = { firstname:fname, lastname:lname, department:depart, hireDate:new Date() }; var msg = '<h2>Employee Added</h2> Name : ' + employee.firstname + employee.lastname + '<br>'; msg += 'Department : ' + employee.department + '<br>'; msg += 'Hire Date : ' + employee.hireDate.toDateString(); output.innerHTML = msg; } function init() { 'use stric'; var form = document.getElementById('form'); form.onsubmit = calculate; }; // end init() window.onload = calculate;
For unknown reason i cant figured it out what is the problem please help
-
i even attach the js file in different ways but it dint work at all
-
but what i have in Source code is different and it is working... I am using Dreamweaver CS6 .. It doesnt show onSubmit() function of window object.
-
<h1>CALCULATOR FOR SHOP</h1> <form id="theform" method="post"> <fieldset> <label>Quantity</label> <input type="number" name="quantity" id="quantity" value="1" min="1" required> <label>Price per unit</label> <input type="number" name="price" id="price" value="1" min="1" required> <label>Tax Rate(%)</label> <input type="text" name="tax" id="tax" value="0.0" required> <label>Discount</label> <input type="text" name="discount" id="discount" value="0.0" required> <label>Total</label> <input type="text" name="total" id="total" value="0.00"> <button>Calculate</button> </fieldset> </form>
This is my HTML
function calculate(){ 'use strict'; var total; var quantity = document.getElementById('quantity').value; var price = document.getElementById('price').value; var tax = document.getElementById('tax').value; var discount = document.getElementById('discount').value; total = quantity * price; tax = tax/1000; tax = tax + 1; total = total * tax; total -= discount; document.getElementById('total').value = total; return false; }; // end of calculate() function function init(){ 'use stric'; var theform = document.getElementById('theform'); theform.onsubmit = calculate; }; window.onload = init;
This is CSS !
this is not working and i am not getting it why :s
-
Oh God ! thanks for reply both you. Well by the way, larry you are so cruel ... you made very long database query in PHP and mysql dynamic web development in its message board chapter.. just kidding
-
Hi,
I wanna know the reason to use this [ $() ]. I dint get its concept :s .. I am now on page 236..chapter 7 creating function.
-
you meant I should left the username field blank?? I am including it this way require('mysqli_connect.php'); is that correct??
if $_SESSION=array(); executed then how the other script will run ? I mean if we want to log out then we have to uncomment it? otherwise the user will stay logged in??
-
Hi,
I am stuck at this place at chapter 17 Message Board. When connecting to database it gives this error
could not connect to database access denied for user 'user'@'localhost' (using password yes)
in mysqli_connect.php
DEFINE ("DB_USER","root")
DEFINE ("DB_PASSWORD","")
DEFINE ("DB_HOST","localhost")
DEFINE ("DB_NAME","forum2")
$connect = @mysqli_connect(DB_USER,DB_PASSWORD,DB_HOST,DB_NAME) or die ('Could Not Connect to Database:'. mysqli_connect_error() ) ;
mysqli_set_charset($connect, 'utf-8').
I have also changed the position of user name local host password but nothing works. What I do I cant figure it out. Please help.
One thing more I am not getting the idea that why $_SESSION = array(); is uncommented to virtually log the user out? how it is possible ?? on page 530 chapter 17 'Message Board
Regards,
Anu'
Different Code In Book !
in Modern Javascript: Develop and Design
Posted
Thank you Hartleysan !