ELATED: Authoring and Programming http://www.elated.com/ The nitty-gritty of coding websites. Get help with HTML, CSS, JavaScript, PHP, Perl, or any other Web programming problem. en-us Sat, 16 Dec 2017 09:03:38 GMT Sat, 16 Dec 2017 09:03:38 GMT http://blogs.law.harvard.edu/tech/rss ELATED.com feeder Re: Build a CMS in an Afternoon with PHP and MySQL http://www.elated.com/forums/topic/5114/#post26905 From: fmjh23


@stevewanjala

I'm not sure how mysql_escape_string worked in this code in 2011 but I don't think you can use mysqli_escape_string with PDO in this code now.

This is a link to the advice at php.net for that function

http://php.net/manual/en/mysqli.real-escape-string.php

mysqli_escape_string and mysqli_real_escape_string are the same thing.

If you look at the link above you will see that you need to pass the database connection as well as the data you want to escape. That is why the error indicates that two parameters are needed.

You could do


Code:
--------------------
mysqli_escape_string($conn, $order)
--------------------



But that will give a different error because $conn is a PDO object and not mysqli. mysqli functions only work with mysqli connections.

I'm still trying to understand why the function has been written that way but for now I am just using $order without any function. This tutorial was written quite a long time ago and possibly there is a better way to work with the publication date than is being used here.

PDO uses prepared statements and bound parameters so not sure why the publicationDate could not have been treated the same way in the getList function as it is in the insert function e.g.

A unix timestamp is the number of seconds that have passed since 1970-01-01 as an unsigned integer so it should be possible to do this instead if the publicationDate needs to be escaped.


Code:
--------------------
$sql = "SELECT SQL_CALC_FOUND_ROWS *, UNIX_TIMESTAMP(publicationDate) AS publicationDate FROM articles ORDER BY " . :order . " LIMIT :numRows";

$st = $conn->prepare($sql);

$st->bindValue( ":numRows", $numRows, PDO::PARAM_INT);

$st->bindValue(":order", $order, PDO::PARAM_INT);

$st->execute();
--------------------


However I've not tried that yet so don't know if it will work and if it does why matt didn't do it that way in the first place? So there's probably some reason why the above it not a reasonable solution.

Further back in the comments there is some discussion of whitelisting and that particular function but haven't had a chance to look at that yet. Just jumped to the end to see if the forum was still being updated.

Hope that helps.

John

--
No signature!

View » | Reply »

]]>
Sun, 26 Nov 2017 22:32:10 GMT http://www.elated.com/forums/topic/5114#post26905
Re: Build a CMS in an Afternoon with PHP and MySQL http://www.elated.com/forums/topic/5114/#post26904 From: csturner


Firstly, I have not gone thru and checked every response yet, but, does anyone else see date creep with their articles, going back one day every time they are submitted or edited?

Secondly, I am trying to add creationDate to track the last time an article was created or subsequently updated. I have it mostly figured out, but how do I have the editArticle form trigger an update to this creationDate based on the date now?

View » | Reply »

]]>
Sun, 26 Nov 2017 21:57:16 GMT http://www.elated.com/forums/topic/5114#post26904
Re: Build a CMS in an Afternoon with PHP and MySQL http://www.elated.com/forums/topic/5114/#post26901 From: csturner


I am going to post a few updates I have made here for others. Disclaimer: I am not a expert, nor do I play one on TV. Other input and correction is appreciated.

After switching to PHP 7.x I had an issue with the general error catching so I replaced the code in config.php with the following:
Original:

Code:
--------------------
function handleException( $exception ) {
echo "Sorry, a problem occurred. Please try later.";
error_log( $exception->getMessage() );
}

set_exception_handler( 'handleException' );
?>
--------------------

My Version:

Code:
--------------------
function handleException( Throwable $t ) {
echo "Sorry, a problem occurred. Please try later." . $t;
error_log( $t->getMessage() );
}

set_exception_handler( 'handleException' );
--------------------


The output is ugly, but it provides a few details on the error page describing the issue. DO NOT use this in production!

[Edited by csturner on 26-Nov-17 11:09]

View » | Reply »

]]>
Sun, 26 Nov 2017 17:05:04 GMT http://www.elated.com/forums/topic/5114#post26901
Re: Hover help http://www.elated.com/forums/topic/6400/#post26898 From: chrishirst


https://www.w3schools.com/cssref/css3_pr_border-radius.asp


Use the :hover pseudo class to apply the properties to the ruleset.

--
Chris.
So long, and thanks for all the fish.
http://webmaster-talk.eu/


View » | Reply »

]]>
Tue, 14 Nov 2017 16:34:55 GMT http://www.elated.com/forums/topic/6400#post26898
Hover help http://www.elated.com/forums/topic/6400/#post26897 From: Casper


Hi. As I said in the title I want to make so when you hover over icon I want there to be a circle around it with the color gold For some reason it created 2 threads.

View » | Reply »

]]>
Mon, 13 Nov 2017 21:21:11 GMT http://www.elated.com/forums/topic/6400#post26897
Re: Native html5 player help with Upload http://www.elated.com/forums/topic/6395/#post26889 From: chrishirst



Code:
--------------------
$uploadDirectory = 'uploadWC/'.$fileName;
--------------------


After that operation $uploadDirectory is no longer a directory, so saving files to that path WILL fail.

--
Chris.
So long, and thanks for all the fish.
http://webmaster-talk.eu/


View » | Reply »

]]>
Mon, 06 Nov 2017 00:59:10 GMT http://www.elated.com/forums/topic/6395#post26889
Native html5 player help with Upload http://www.elated.com/forums/topic/6395/#post26887 From: chrisjchrisj


Native html5 video player starts, stops & records successfully, but need help with Upload.
This web video player starts, stops, records and plays back successfully, but the Upload portion needs help. Although the console shows "Success", no file actually arrives. Any guidance/suggestion/remedy to get the recorded video to Upload to a folder, will be welcomed. Thanks.



Code:
--------------------
..............
<button class="start" disabled>Start</button>
<button class="stop" disabled>Stop</button>
<button class="reset" disabled>Reset</button>
<button class="upload" onclick="InitUploading()" disabled>Upload</button>

<script>

const video = document.querySelector('video')
const start = document.querySelector('.start')
const stop = document.querySelector('.stop')

const initRecorder = stream => {

const recorder = new MediaRecorder(stream)

video.srcObject = stream
start.removeAttribute('disabled')

video.addEventListener('loadedmetadata', () => {
video.play()
})

recorder.addEventListener('dataavailable', ({ data }) => {
video.srcObject = null
video.src = URL.createObjectURL(data)
})

start.addEventListener('click', () => {
stop.removeAttribute('disabled')
recorder.start()
})

stop.addEventListener('click', () => {
recorder.stop()
})


// Upload the video blob as form data


upload.addEventListener('click', () => {
const body = new FormData()

body.append('myvideo', blob)

fetch('upload.php', { method: 'POST', body })
.then(() => console.log('Success!'))
.catch(console.error)

})

}

navigator
.mediaDevices
.getUserMedia({ video: true })
.then(initRecorder)
.catch(console.error)

</script>
Here's the upload.php file:
--------------------


Here's the upload.php file:



Code:
--------------------
<?php
foreach(array('video', 'audio') as $type) {
if (isset($_FILES["${type}-blob"])) {

//echo 'uploadWC/';

$fileName = $_POST["${type}-filename"];
$uploadDirectory = 'uploadWC/'.$fileName;

if (!move_uploaded_file($_FILES["${type}-blob"]["tmp_name"], $uploadDirectory)) {
echo(" problem moving uploaded file");
}

echo($fileName);
}
}
?>
--------------------


View » | Reply »

]]>
Sat, 04 Nov 2017 16:34:27 GMT http://www.elated.com/forums/topic/6395#post26887
Re: Super easy well not for me I guess http://www.elated.com/forums/topic/6393/#post26882 From: chrishirst


Oh and wage deductions are generally based on greater than calculations '>' rather than less than '<'

--
Chris.
So long, and thanks for all the fish.
http://webmaster-talk.eu/


View » | Reply »

]]>
Wed, 25 Oct 2017 12:18:53 GMT http://www.elated.com/forums/topic/6393#post26882
Re: Super easy well not for me I guess http://www.elated.com/forums/topic/6393/#post26881 From: chrishirst


Using the correct variable in this conditional

if(pay < 300.01)

could be a starting point.

--
Chris.
So long, and thanks for all the fish.
http://webmaster-talk.eu/


View » | Reply »

]]>
Wed, 25 Oct 2017 12:15:15 GMT http://www.elated.com/forums/topic/6393#post26881
Super easy well not for me I guess http://www.elated.com/forums/topic/6393/#post26880 From: TotoroFan


Just starting out in a programming course and I'm stumped and I frustrated I need to know how to get both the withholding's and net I cannot figure out how to write it so the program figures out both equations. Please help. Thanks.


Code:
--------------------
<script>
var pay = prompt("Enter your houly pay");
var hour = prompt("Enter your hours worked");
var GROSS = parseFloat(pay * hour);
var WITH;
var NET;

if(pay < 300.01)
{
WITH = pay * hour * .10;
NET = pay - WITH;
alert(("GROSS PAY: $" + GROSS.toFixed(2)) + ("\nWITHHOLDING: $" + WITH.toFixed(2)) + ("\nNET PAY: $" + NET.toFixed(2)));
}
</script>
--------------------


View » | Reply »

]]>
Mon, 23 Oct 2017 02:52:59 GMT http://www.elated.com/forums/topic/6393#post26880
Re: Build a CMS in an Afternoon with PHP and MySQL http://www.elated.com/forums/topic/5114/#post26879 From: stevewanjala


Thank you chris for your response i managed to get the

now the project would run but with another error
Warning: mysqli_escape_string() expects exactly 2 parameters, 1 given in C:\xampp\htdocs\cms\classes\Article.php on line 106


Code:
--------------------
public static function getList( $numRows=1000000, $order="publicationDate DESC" ) {
$conn = new PDO( DB_DSN, DB_USERNAME, DB_PASSWORD );
$sql = "SELECT SQL_CALC_FOUND_ROWS *, UNIX_TIMESTAMP(publicationDate) AS publicationDate FROM articles
ORDER BY " . mysqli_escape_string($order) . " LIMIT :numRows";

$st = $conn->prepare( $sql );
$st->bindValue( ":numRows", $numRows, PDO::PARAM_INT );
$st->execute();
$list = array();

while ( $row = $st->fetch() ) {
$article = new Article( $row );
$list[] = $article;
}

// Now get the total number of articles that matched the criteria
$sql = "SELECT FOUND_ROWS() AS totalRows";
$totalRows = $conn->query( $sql )->fetch();
$conn = null;
return ( array ( "results" => $list, "totalRows" => $totalRows[0] ) );
}
--------------------



please advice where am i going wrong

and any article that i add on the admin side will be saved on the database but it wont appear in the frontend side of the page,

View » | Reply »

]]>
Thu, 19 Oct 2017 08:27:13 GMT http://www.elated.com/forums/topic/5114#post26879
Re: Build a CMS in an Afternoon with PHP and MySQL http://www.elated.com/forums/topic/5114/#post26878 From: chrishirst


Replace the generic "something went wrong" with a detailed error message.

http://php.net/manual/en/function.error-reporting.php

--
Chris.
So long, and thanks for all the fish.
http://webmaster-talk.eu/


View » | Reply »

]]>
Thu, 19 Oct 2017 07:48:23 GMT http://www.elated.com/forums/topic/5114#post26878
Re: Build a CMS in an Afternoon with PHP and MySQL http://www.elated.com/forums/topic/5114/#post26877 From: stevewanjala


KINDLY ASSIST :

I KEEP RECEIVING THE BELOW ERROR MESSAGE
Sorry, a problem occurred. Please try later.

have noticed its in the index.php code section but can not tell which line to be exact throws the error.

View » | Reply »

]]>
Wed, 18 Oct 2017 10:47:31 GMT http://www.elated.com/forums/topic/5114#post26877
How to reset videovideo timer http://www.elated.com/forums/topic/6392/#post26876 From: chrisjchrisj


I'm using this webRTC webcam recorder <video></video> successfully, which has a webcam-view button to start/show the webcam view. And a Start Recording button to begin recording the webcam view.

I've been trying to get the player controls timer to reset to 0:00 upon selecting the Start Recording button (because the timer apparently starts upon webcam view button selection), so that the person recording will have an idea how long the recording is, while recording. I tried adding things to this function, to accomplish that, like video.load; currentTime = 0; etc, without success (maybe those additions were in the wrong place?). Any help/suggestions/guidance will be appreciated.



Code:
--------------------
<script type="text/javascript">
var video = document.querySelector('video');

function startCamera() {
//document.getElementById('btn-start-camera').disabled = true;
document.getElementById('btn-start-recording').disabled = false;
//document.getElementById('btn-stop-camera').disabled = false;
captureCamera(function (camera) {
setSrcObject(camera, video);
global_camera = camera;
});
}

function captureCamera(callback) {
navigator.mediaDevices.getUserMedia({
audio: true,
video: true
}).then(function (camera) {
callback(camera);
}).catch(function (error) {
alert('Unable to capture camera. To try again - simply refresh your page');
console.error(error);
});
}

function stopRecordingCallback() {
video.src = video.srcObject = null;
video.src = URL.createObjectURL(recorder.getBlob());
PrepareBlob();
document.getElementById("upload-video").disabled = false;

// release camera
recorder.camera.getTracks().forEach(function (track) {
track.stop();
});

recorder.camera.stop();
recorder.destroy();
recorder = null;
}
var recorder; // globally accessible
document.getElementById('btn-start-recording').onclick = function () {
this.disabled = true;
document.getElementById("upload-video").disabled = true;
captureCamera(function (camera) {
setSrcObject(camera, video);
recorder = RecordRTC(camera, {
type: 'video'
});

recorder.startRecording();
video.controls = true;
// release camera on stopRecording
recorder.camera = camera;
document.getElementById('btn-stop-recording').disabled = false;
});
};
document.getElementById('btn-stop-recording').onclick = function () {
this.disabled = true;
document.getElementById('btn-start-recording').disabled = false;

recorder.stopRecording(stopRecordingCallback);
};
var blob, fileName, fileObject;
function PrepareBlob() {
// get recorded blob
blob = recorder.getBlob();
// generating a random file name
fileName = getFileName('webm');
// we need to upload "File" --- not "Blob"
fileObject = new File([blob], fileName, {
type: 'video/webm'
});
}
function InitUploading()
{
uploadToPHPServer(fileObject, function (response, fileDownloadURL) {
if (response !== 'ended') {
document.getElementById('header').innerHTML = response; // upload progress
return;
}

document.getElementById('header').innerHTML = '<a href="' + fileDownloadURL + '" target="_blank">' + fileDownloadURL + '</a>';
alert('Successfully uploaded recorded blob.');

alert('Successfully uploaded recorded blob.');
// preview uploaded file
video.src = fileDownloadURL;
// open uploaded file in a new tab
window.open(fileDownloadURL);
});
}

function uploadToPHPServer(blob, callback) {
// create FormData
var formData = new FormData();
formData.append('video-filename', blob.name);
formData.append('video-blob', blob);
callback('Uploading recorded-file to server.');
makeXMLHttpRequest('save.php', formData, function (progress) {
if (progress !== 'upload-ended') {
callback(progress);
return;
}
var initialURL = 'uploads/' + blob.name;
callback('ended', initialURL);
});
}

function makeXMLHttpRequest(url, data, callback) {
var request = new XMLHttpRequest();
request.onreadystatechange = function () {
if (request.readyState == 4 && request.status == 200) {
if (request.responseText === 'success') {
callback('Upload Complete');
return;
}
// alert(request.responseText);
window.location.href = 'UploadWC.html';
return;
}
};
request.upload.onloadstart = function () {
callback('Upload started...');
};
request.upload.onprogress = function (event) {
callback('Upload Progress ' + Math.round(event.loaded / event.total * 100) + "%");
};
request.upload.onload = function () {
callback('Progress Ending');
};
request.upload.onload = function () {
callback('Upload Complete');
};
request.upload.onerror = function (error) {
callback('Upload failed.');
};
request.upload.onabort = function (error) {
callback('Upload aborted.');
};
request.open('POST', url);
request.send(data);
}
// this function is used to generate random file name
function getFileName(fileExtension) {
var d = new Date();
var year = d.getUTCFullYear();
var month = d.getUTCMonth();
var date = d.getUTCDate();
return 'RecordRTC-' + year + month + date + '-' + getRandomString() + '.' + fileExtension;
}

function getRandomString() {
if (window.crypto && window.crypto.getRandomValues && navigator.userAgent.indexOf('Safari') === -1) {
var a = window.crypto.getRandomValues(new Uint32Array(3)),
token = '';
for (var i = 0, l = a.length; i < l; i++) {
token += a[i].toString(36);
}
return token;
} else {
return (Math.random() * new Date().getTime()).toString(36).replace(/\./g, '');
}
}
</script>
--------------------


[Edited by chrisjchrisj on 16-Oct-17 14:01]

View » | Reply »

]]>
Mon, 16 Oct 2017 20:00:15 GMT http://www.elated.com/forums/topic/6392#post26876
Re: When I press delete, nothing happens http://www.elated.com/forums/topic/6390/#post26869 From: myriko


Thank you Chris.

No Need clue more than that,
I fixed it

Riko

View » | Reply »

]]>
Mon, 09 Oct 2017 07:27:34 GMT http://www.elated.com/forums/topic/6390#post26869
Re: stuck! http://www.elated.com/forums/topic/6385/#post26868 From: newbie1022


I simply copy/pasted them into the CSS where it applied to the space where I was trying to center the element. It did not work, and I really need to learn the why's and whats of what the code does. I want to get my head around vertical centering! Thanks! Jim

--
Jim Williams

View » | Reply »

]]>
Sun, 08 Oct 2017 23:44:04 GMT http://www.elated.com/forums/topic/6385#post26868
Re: stuck! http://www.elated.com/forums/topic/6385/#post26867 From: chrishirst


And how have you set the CSS to apply those rules to an element??

--
Chris.
So long, and thanks for all the fish.
http://webmaster-talk.eu/


View » | Reply »

]]>
Sun, 08 Oct 2017 22:13:52 GMT http://www.elated.com/forums/topic/6385#post26867
Re: Separate a string before a number http://www.elated.com/forums/topic/6381/#post26866 From: chrishirst



Code:
--------------------
var strA= "sdfls jfsdkfjh3 58sklf039 5857dfkkjhksjf h";
var strB = strA.split(/(\d+)/);

--------------------


will get you this: sdfls jfsdkfjh,3, ,58,sklf,039, ,5857,dfkkjhksjf h

--
Chris.
So long, and thanks for all the fish.
http://webmaster-talk.eu/


View » | Reply »

]]>
Sun, 08 Oct 2017 22:11:44 GMT http://www.elated.com/forums/topic/6381#post26866
Re: When I press delete, nothing happens http://www.elated.com/forums/topic/6390/#post26864 From: chrishirst


In that code, .... .... Haven't got a clue.

Where is the rest of the code that is necessary to start testing???

--
Chris.
So long, and thanks for all the fish.
http://webmaster-talk.eu/


View » | Reply »

]]>
Sun, 08 Oct 2017 21:20:50 GMT http://www.elated.com/forums/topic/6390#post26864
When I press delete, nothing happens http://www.elated.com/forums/topic/6390/#post26863 From: myriko


Hi Friends , What I did wrong in this code that it does not work? the button appears when click on it nothing happens.. Thanks


Code:
--------------------

$(document).ready(function() {
var p2_max_fields = 10; //maximum input boxes allowed
var p2_wrapper = $(".p2_input_fields_wrap"); //Fields p2_wrapper
var p2_add_button = $(".p2_add_field_button"); //Add button ID

var x = 1; //initlal text box count
$(p2_add_button).click(function(e){ //on add input button click
e.preventDefault();
if(x < p2_max_fields){ //max input box allowed
x++; //text box increment
$(p2_wrapper).append('<div id="del-'+x+'" class="my_col col-md-12"><div class="col-lg-2"> <input placeholder="Description="p2_Description[]" class="form-control fullwidth " value="" ></div><div class="col-lg-2"> <input placeholder="ProtectionRequirments" name="p2_ProtectionRequirments[]" class="form-control fullwidth" value="" ></div><div class="col-lg-2"> <input placeholder="Done" name="p2_Done[]" style="margin-bottom:15px;" class="form-control fullwidth " value="" ></div><div class="col-lg-2"> <input placeholder="NotCarriedout" name="p2_NotCarriedout[]" class="form-control fullwidth" value="" ></div><div class="col-lg-2"> <input placeholder="Comments" name="p2_Comments[]" class="form-control fullwidth" value="" ></div><div class="col-lg-2"><a href="#" class="btn btn-danger" data-rel="'+x+'">Remove</a></div></div>'); //add input box .
}
});

$(wrapper).on("click",".remove_field", function(e){ //user click on remove text
e.preventDefault();
var delx = $(this).attr("data-rel");
$('#del-'+delx).remove(); x--;
--------------------


Mod note; code delimiters added

[Edited by chrishirst on 08-Oct-17 15:17]

View » | Reply »

]]>
Sun, 08 Oct 2017 07:42:48 GMT http://www.elated.com/forums/topic/6390#post26863
Re: stuck! http://www.elated.com/forums/topic/6385/#post26859 From: newbie1022


I do NOT know how to vertically center a header in a space I had designed for it. I thought I had it with some code written by the instructor I am watching in YouTube. I applied his code from a similar exercise, but it did not do what i needed it to do. Here is the stylesheet code he used, and it worked, but not on my site. Again, this is CSS code, not html.

position:relative;
top:50%;
-webkit-transform: translate Y(-50%);
-ms transform: translate Y(-50%);
transform: translateY(-50%);

[Edited by newbie1022 on 06-Oct-17 20:21]

--
Jim Williams

View » | Reply »

]]>
Sat, 07 Oct 2017 02:12:05 GMT http://www.elated.com/forums/topic/6385#post26859
Re: Jquery not working http://www.elated.com/forums/topic/6386/#post26856 From: chrishirst


What exactly is a "Spring Controller"???

--
Chris.
So long, and thanks for all the fish.
http://webmaster-talk.eu/


View » | Reply »

]]>
Thu, 05 Oct 2017 18:13:25 GMT http://www.elated.com/forums/topic/6386#post26856
Re: stuck! http://www.elated.com/forums/topic/6385/#post26854 From: chrishirst


"but the code I have for centering it vertically isn't working"

Define 'not working' and provide the 'code'.

--
Chris.
So long, and thanks for all the fish.
http://webmaster-talk.eu/


View » | Reply »

]]>
Thu, 05 Oct 2017 18:10:29 GMT http://www.elated.com/forums/topic/6385#post26854
Re: Build a CMS in an Afternoon with PHP and MySQL http://www.elated.com/forums/topic/5114/#post26853 From: chrishirst


"But i got simple error with message "Sorry, a problem occurred. Please try later." stated in exception handler of config.php."

You have probably missed out a semicolon or spelt something incorrectly.

--
Chris.
So long, and thanks for all the fish.
http://webmaster-talk.eu/


View » | Reply »

]]>
Thu, 05 Oct 2017 18:08:43 GMT http://www.elated.com/forums/topic/5114#post26853
Re: Build a CMS in an Afternoon with PHP and MySQL http://www.elated.com/forums/topic/5114/#post26852 From: chrishirst


"Well, I don't know what "username" means."

The default username for MySQL is 'root'


"mysql>create database cms;"

You open a command window, start the mysql session and you will get a mysql> prompt for you to start typing commands into.

--
Chris.
So long, and thanks for all the fish.
http://webmaster-talk.eu/


View » | Reply »

]]>
Thu, 05 Oct 2017 18:07:25 GMT http://www.elated.com/forums/topic/5114#post26852
Jquery not working http://www.elated.com/forums/topic/6386/#post26851 From: samee


Hi Members ,

I'm trying to build an email template form my project website. The template appears as a template once I try to submit my parent form. In this template TO, SUBJECT and BODY of the email is fixed and not enabled for user to edit only CC(textfield) and COMMENT(textarea) are there which user can edit. Now when the user submits the send button in the template it first saves the parent form then sends the email which is handled by a controller function in spring on the other hand the template creation is in Jquery and the submit is also handled in jQuery to pass control to Spring controller. The above functionality works fine if user doesn't enter anything in COMMENT but if user types anything in COMMENT the page perhaps kind of stuck. When i check the web browser their is no error and even i placed console.log after each line and the log gets printed but somehow the control is not passed to the spring Controller. when i tried replacing the comment with a non editable content like BODY the functionality
worked fine. Can anyone point me in some direction how to debug this issue it seems even i'm stuck with the page.

View » | Reply »

]]>
Thu, 05 Oct 2017 09:30:13 GMT http://www.elated.com/forums/topic/6386#post26851
stuck! http://www.elated.com/forums/topic/6385/#post26850 From: newbie1022


I am designing a website, and I have a name in a header. It is centered horizontally, but the code I have for centering it vertically isn't working. Ideas? I need specific code for this, please. Thanks!

--
Jim Williams

View » | Reply »

]]>
Tue, 03 Oct 2017 15:39:41 GMT http://www.elated.com/forums/topic/6385#post26850
Separate a string before a number http://www.elated.com/forums/topic/6381/#post26844 From: couriousScript


Hi all! I'm a complete noob, learning JavaScript (didn't specify this in the title, sorry) and I'd appreciate some help. Is there a way I can turn a string that contains numbers, letters, and spaces into an array, or simply slice it into different strings, but do it before the number? For example, if I have such a string "sdfls jfsdkfjh3 58sklf039 5857dfkkjhksjf h", I'd like to "pick out" the numbers only, and get an array of strings with numbers separated from the rest. I realize I can use regular expressions to pick out only numbers, but that just gives me an array of numbers, without everything else.

Thank you!

[Edited by couriousScript on 01-Oct-17 10:31]

View » | Reply »

]]>
Sun, 01 Oct 2017 16:30:42 GMT http://www.elated.com/forums/topic/6381#post26844
Re: Build a CMS in an Afternoon with PHP and MySQL http://www.elated.com/forums/topic/5114/#post26843 From: Alisha


I was going through this tutorial and i found it to be quite understanding and useful. I made some changes to the code as like timezone, db user . But i got simple error with message "Sorry, a problem occurred. Please try later." stated in exception handler of config.php. Will you please let me know what actually went wrong? Please help me figure it out and solve my problem. Thank you in advance.

[Edited by Alisha on 01-Oct-17 09:50]

View » | Reply »

]]>
Sun, 01 Oct 2017 15:48:48 GMT http://www.elated.com/forums/topic/5114#post26843
mail form work but not capatcha http://www.elated.com/forums/topic/6380/#post26842 From: nf24eg


hello, I've a mail form it was working well that when I press the submit, the capatcha window popup, and I receive the email, but after I changed the format the capatcha doesn't work, but i receive the email !!!
so first, I would like to know why the capatcha stopped
my codes is :
Html

Code:
--------------------
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="https://www.google.com/recaptcha/api.js" async="async" defer="defer"></script>
<meta charset="utf-8">
<title>Feedback</title>
<style>
.filedset {
border:2px solid black;
border-radius:10px;
margin-left:50px;
}
.input:focus {
background-color: #FCF5D8;
}
#contact_form{
margin-left:10px;
}
#name{
font-size:16px;
border:1px solid black;
border-radius:10px;
padding: 5px;
}
#email{
font-size:16px;
border:1px solid black;
border-radius:10px;
padding: 5px;
}
#message{
font-size:16px;
border:1px solid black;
border-radius:10px;
padding: 5px;
}
#g-recaptcha {
border-radius:25px;
margin-left:120px;
}
</style>
</head>
<body>
<fieldset style="width:130px" class="filedset">
<legend class="auto-style">
<p><b>Contact us</b></p>
</legend>
<form action="feedback.php" method="post" id="myfbform" accept-charset="UTF-8">
<label for="myname">Name:</label><br />
<input name="fullname" type="text" required class="input" id="myname" value="" size="39" /><br />
<br />
<label for="myemail">Email:</label><br />
<input name="email" type="text" required class="input" id="myemail" value="" size="39" /><br />
<br />
<label for="mycomments">Comments:</label><br />
<textarea name="comments" cols="45" rows="15" required class="input" id="mycomments" placeholder="It's nice to hear from you" /></textarea><br />
<br />
<br />
<p id="my_js_message">
Error: please enable JavaScript and reload this page before using the form.
</p>
<script type="text/javascript">
var my_js_message_block ;
my_js_message_block = document.getElementById( 'my_js_message' );
my_js_message_block.parentNode.removeChild( my_js_message_block );
</script>
<script type="text/javascript">
function my_feedback_onsubmit( token ) { document.getElementById( "myfbform" ).submit() ; }
</script>
<input id="mysubmit" type="submit" class="g-recaptcha" data-sitekey="##########################"
data-callback="my_feedback_onsubmit"
value="Send Feedback" />
<div class="g-recaptcha" data-sitekey="##########################"></div>
</form>
</filedset>
</body>
</html>
--------------------

I've replaced the key with#
Second request, I've made the filed "required" but it doesn't work till the user is done !! I think it one the user press on submit the missed filed should blink in red or so.
Third problem, I don't know where to put the email format validation code.

I hope someone out there can help.
P.S: I liked the presentation of that forum, hope I can find the help which I'm looking for in here

View » | Reply »

]]>
Sat, 30 Sep 2017 00:15:05 GMT http://www.elated.com/forums/topic/6380#post26842
Re: Build a CMS in an Afternoon with PHP and MySQL http://www.elated.com/forums/topic/5114/#post26841 From: mrblond


I've just came across this tutorial and decided to try it.

Well, I downloaded XAMPP and ran the installer.

Then 1. I opened a terminal window via XAMPP which shows this:

Setting environment for using XAMPP for Windows.
44@44-PC c:\xampp
#

I think that 44 is the name of the computer.

in the instructions it is said to past this:
mysql -u username -p

Well, I don't know what "username" means. This is my personal laptop and I don't have neither username nor password.
So I don't know how to open and start:
mysql>create database cms;

Thanks in advance for helping me continue.

[Edited by mrblond on 28-Sep-17 15:28]

View » | Reply »

]]>
Thu, 28 Sep 2017 21:26:01 GMT http://www.elated.com/forums/topic/5114#post26841
Table Cell Background Gradient http://www.elated.com/forums/topic/6379/#post26839 From: huntd04


Hi I am kind of new at this but I was hoping that you could assist me. What I am wanting to do is create a webpage that has two dropdown menus on it with a button and then below a table. On the dropdowns I would like for the values to be various colors. Then once the user selects two colors I would like for them to be able to click the button and for the background color of one of the table cells to become a gradient starting with the value of the first dropdown and ending with the value of the second dropdown. I preferably like the scripting that would have to be done, done in Javascript as even though I am not good at it I know enough to alter that language if needed.

Thanks for your help in advance.

View » | Reply »

]]>
Tue, 26 Sep 2017 03:32:23 GMT http://www.elated.com/forums/topic/6379#post26839
Re: I'd like some help making a button trigger some scripts. http://www.elated.com/forums/topic/6378/#post26838 From: chrishirst


https://developers.google.com/sheets/api/
https://developers.google.com/slides/

--
Chris.
So long, and thanks for all the fish.
http://webmaster-talk.eu/


View » | Reply »

]]>
Thu, 21 Sep 2017 23:12:37 GMT http://www.elated.com/forums/topic/6378#post26838
I'd like some help making a button trigger some scripts. http://www.elated.com/forums/topic/6378/#post26837 From: sac396


I can't seem to figure out how to do this. I am making a google chrome extension and I'd like the button to add text to a google doc. Any help would be appreciated!

View » | Reply »

]]>
Wed, 20 Sep 2017 05:21:04 GMT http://www.elated.com/forums/topic/6378#post26837
Re: Problem in inserting partial data from dropdown to mysql using PHP http://www.elated.com/forums/topic/6376/#post26836 From: chrishirst


A space character is a delimiter for HTTP form data so you need to URL Encode the data before sending it.

--
Chris.
So long, and thanks for all the fish.
http://webmaster-talk.eu/


View » | Reply »

]]>
Tue, 19 Sep 2017 13:11:58 GMT http://www.elated.com/forums/topic/6376#post26836
Re: Auto button click http://www.elated.com/forums/topic/6377/#post26835 From: chrishirst


"Please, tell me the solution to make above change, "

Use a timer;
https://www.elated.com/articles/javascript-timers-with-settimeout-and-setinterval/

--
Chris.
So long, and thanks for all the fish.
http://webmaster-talk.eu/


View » | Reply »

]]>
Tue, 19 Sep 2017 13:07:25 GMT http://www.elated.com/forums/topic/6377#post26835
Auto button click http://www.elated.com/forums/topic/6377/#post26834 From: sebarian87


i have following index file, it has recording stop and start button to record voice.

I want the recording to begin automatically after 9 seconds as the page is loaded and closes itself after 20 seconds.

Please, tell me the solution to make above change,


--

<!DOCTYPE html>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Live input record and playback</title>
<style type='text/css'>
ul { list-style: none; }
#recordingslist audio { display: block; margin-bottom: 10px; }
</style>
<link href="css/style.css" rel="stylesheet" type="text/css" />
</head>
<body>

<h1>Record to MP3 Test</h1>

<button onclick="startRecording(this);">record</button>
<button onclick="stopRecording(this);" disabled>stop</button>

<h2>Recordings</h2>
<ul id="recordingslist"></ul>

<h2>Log</h2>
<pre id="log"></pre>

<script>
function __log(e, data) {
log.innerHTML += "\n" + e + " " + (data || '');
}

var audio_context;
var recorder;

function startUserMedia(stream) {
var input = audio_context.createMediaStreamSource(stream);
__log('Media stream created.' );
__log("input sample rate " +input.context.sampleRate);

// Feedback!
//input.connect(audio_context.destination);
__log('Input connected to audio context destination.');

recorder = new Recorder(input, {
numChannels: 1
});
__log('Recorder initialised.');
}

function startRecording(button) {
recorder && recorder.record();
button.disabled = true;
button.nextElementSibling.disabled = false;
__log('Recording...');
setTimeout(stopRecording, 50);
}

function stopRecording(button) {
recorder && recorder.stop();
button.disabled = true;
button.previousElementSibling.disabled = false;
__log('Stopped recording.');

// create WAV download link using audio data blob
createDownloadLink();

recorder.clear();
}

function createDownloadLink() {
recorder && recorder.exportWAV(function(blob) {
/*var url = URL.createObjectURL(blob);
var li = document.createElement('li');
var au = document.createElement('audio');
var hf = document.createElement('a');

au.controls = true;
au.src = url;
hf.href = url;
hf.download = new Date().toISOString() + '.wav';
hf.innerHTML = hf.download;
li.appendChild(au);
li.appendChild(hf);
recordingslist.appendChild(li);*/
});
}

window.onload = function init() {
try {
// webkit shim
window.AudioContext = window.AudioContext || window.webkitAudioContext;
navigator.getUserMedia = ( navigator.getUserMedia ||
navigator.webkitGetUserMedia ||
navigator.mozGetUserMedia ||
navigator.msGetUserMedia);
window.URL = window.URL || window.webkitURL;

audio_context = new AudioContext;
__log('Audio context set up.');
__log('navigator.getUserMedia ' + (navigator.getUserMedia ? 'available.' : 'not present!'));
} catch (e) {
alert('No web audio support in this browser!');
}

navigator.getUserMedia({audio: true}, startUserMedia, function(e) {
__log('No live audio input: ' + e);
});
};
</script>

<script src="js/jquery-1.11.0.min.js"></script>
<script src="recordmp3.js"></script>
</body>
</html>

View » | Reply »

]]>
Tue, 19 Sep 2017 06:32:04 GMT http://www.elated.com/forums/topic/6377#post26834
Re: Build a CMS in an Afternoon with PHP and MySQL http://www.elated.com/forums/topic/5114/#post26833 From: BusyWitch


Hi Matt...

I am starting from the beginning and re-writing the code and came across a little snag... and I would appreciate your help.

In the new code, "id" is now "article_id", "publicationDate" is "article_date", "title" is "article_title", and so on. Yes, I have updated the entire code, unless I have missed something.

Here is the problem... upon logging in to admin and entering the very first article, when I hit submit, I get the following error: Fatal error: Article::insert(): Attempt to insert an Article object that already has its ID property set (to 0). in /home/xxxxx/public_html/test-5/classes/Article.php on line 110

Any ideas?

View » | Reply »

]]>
Sun, 17 Sep 2017 22:06:20 GMT http://www.elated.com/forums/topic/5114#post26833
Problem in inserting partial data from dropdown to mysql using PHP http://www.elated.com/forums/topic/6376/#post26832 From: maideen5


Hi
I have an issue to insert data from dropdown to mysql.
It is inserting the partial data to database
Example: if selection is Account Dept, but inserted only Account. missing Dept
if selection is Non Active, inserted only Non. missing Active.
whatever coming after space, it cannot be inserted. It happens only in dropdown control.

In Database, using varchar(30) for column

Pls advice where I did wrong.
Thank you
Maideen

Here is my HTML code


Code:
--------------------
<label>Status</label>
<select class="form-control" data-placeholder="Choose a Category" name="status">
<option></option>
<?php
$sql = "select * from tbl_parameter where paramhead ='STATUS' order by paramdetails";
$stmt = $pdo->prepare($sql);
$stmt->execute();
while ($row = $stmt->fetch())
{
$optvalue = $row['paramdetails'];
print '<option value ='.$optvalue.'>' .$row['paramdetails']. '</option>';

}

?>
</select>
--------------------


php code

Code:
--------------------
if(isset($_POST['add']))
{
if($_SERVER["REQUEST_METHOD"] == "POST")
{
$staffid =$_POST['staffid'];
$staffname =$_POST['staffname'];
$gender =$_POST['gender'];
$department=$_POST['department'];
$emailid=$_POST['emailid'];
$hpno=$_POST['hpno'];
$address=$_POST['address'];
$city=$_POST['city'];
$state=$_POST['state'];
$country=$_POST['country'];
$status=$_POST['status'];
$createdby=$_COOKIE['username'];
$time = strftime("%X");
$date = strftime("%B %d,%Y");
$createdon = date("Y-m-d H:i:s");
$terminal=$_COOKIE['terminal'];

$bool = true;
$sql="insert into tbl_staff_master(staffid,staffname,gender,department,emailid,hpno,address,city,state,country,status,createdby,createdon,terminal)
values ('$staffid','$staffname','$gender','$department','$emailid','$hpno','$address','$city','$state','$country','$status','$createdby','$createdon','$terminal')";
$stmt=$pdo->prepare($sql);
$stmt->execute();
$pdo = null;
print '<script>alert("Saved");</script>';
header("location:staff_add.php");
}
}
--------------------


View » | Reply »

]]>
Sun, 17 Sep 2017 10:43:38 GMT http://www.elated.com/forums/topic/6376#post26832
Re: Neophyte JS seeking help to complete exercise http://www.elated.com/forums/topic/6374/#post26831 From: chrishirst


Your function definition requires two parameters

Code:
--------------------
function calculateFoodOrder(numAnimals, avgFood)
--------------------



Your function call passes none.

Code:
--------------------
calculateFoodOrder();
--------------------


*******************************************************************


"I did not understand how to return an array of objects that contain the animals' information,"



Code:
--------------------
return ArrayName;
--------------------


[Edited by chrishirst on 15-Sep-17 17:54]

--
Chris.
So long, and thanks for all the fish.
http://webmaster-talk.eu/


View » | Reply »

]]>
Fri, 15 Sep 2017 23:54:32 GMT http://www.elated.com/forums/topic/6374#post26831
Re: How do I move my form to center http://www.elated.com/forums/topic/6375/#post26830 From: chrishirst


"How can I move the form to the center of the page?"


Give it a width that is less than the width of the parent, set left and right margin to auto;

"Also, I would like to change the color of the submit button to red, and the text to white."



Code:
--------------------
{
background-color: red;
color: white;
}
--------------------


[Edited by chrishirst on 15-Sep-17 17:46]

--
Chris.
So long, and thanks for all the fish.
http://webmaster-talk.eu/


View » | Reply »

]]>
Fri, 15 Sep 2017 23:45:10 GMT http://www.elated.com/forums/topic/6375#post26830
Re: Inline Style Of A Slider Doesn't Change Permanently http://www.elated.com/forums/topic/6373/#post26829 From: chrishirst


"Is there any way to change PERMANENTLY the max-width of the specific div?"

Assuming that "using javascript" is implied, the answer is ... No.


Your option is to make the 'slide-change' routine query the current max-width property and then set it to that value.

--
Chris.
So long, and thanks for all the fish.
http://webmaster-talk.eu/


View » | Reply »

]]>
Fri, 15 Sep 2017 23:36:59 GMT http://www.elated.com/forums/topic/6373#post26829
How do I move my form to center http://www.elated.com/forums/topic/6375/#post26828 From: cinque8


Hello,

I am trying to create a squeeze page. I downloaded the code for my form from Aweber and placed it into my PageBreeze HTML editor. But the form is on the left side of the page. How can I move the form to the center of the page?

Also, I would like to change the color of the submit button to red, and the text to white.

Any help that you can give me will be greatly appreciated.

Thank you



Code:
--------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title></title>
<meta content="PageBreeze Pro HTML Editor (http://www.pagebreeze.com)" name="GENERATOR" />
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type" />
</head>
<body bgcolor="#ffffff">
<h1>&nbsp;</h1>

<h2 align="left">&nbsp;</h2>

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <!-- AWeber Web Form Generator 3.0.1 --></p>

<p>&nbsp;</p>

<form accept-charset="UTF-8" action="https://www.aweber.com/scripts/addlead.pl" class="af-form-wrapper" method="post" target="_blank">
<div style="display: none"><input name="meta_web_form_id" type="hidden" value="1991411101" /> <input name="meta_split_id" type="hidden" /> <input name="listname" type="hidden" value="awlist4806168" /> <input id="redirect_41e503e55e268d841032ed3217e9f27e" name="redirect" type="hidden" value="http://launchpointforgrowingtaller.info/thankyou.html" /> <input name="meta_adtracking" type="hidden" value="Grow_Taller_Form" /> <input name="meta_message" type="hidden" value="1" /> <input name="meta_required" type="hidden" value="name,email" /> <input name="meta_tooltip" type="hidden" /></div>

<div class="af-form" id="af-form-1991411101">
<div class="af-header" id="af-header-1991411101">
<div class="bodyText">
<p>&nbsp;</p>
</div>
</div>

<div class="af-body af-standards" id="af-body-1991411101">
<div class="af-element"><span style="font-size: 26px"><strong><span style="color: #ff0000"><label class="previewLabel" for="awf_field-93026630">First Name: </label></span></strong></span>

<div class="af-textWrap"><input class="text" id="awf_field-93026630" name="name" onblur="if (this.value == '') { this.value='';} " onfocus=" if (this.value == '') { this.value = ''; }" size="16" style="height: 34px; width: 254px" tabindex="500" type="text" /></div>

<div class="af-clear">&nbsp;</div>
</div>

<div class="af-element"><span style="font-size: 26px"><strong><span style="color: #ff0000"><label class="previewLabel" for="awf_field-93026631">Email: </label></span></strong></span>

<div class="af-textWrap"><input class="text" id="awf_field-93026631" name="email" onblur="if (this.value == '') { this.value='';} " onfocus=" if (this.value == '') { this.value = ''; }" style="height: 35px; width: 254px" tabindex="501" type="text" /></div>

<div class="af-clear">&nbsp;</div>
</div>

<div class="af-element buttonContainer">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<div class="af-clear">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<span style="color: #ff0000"><input class="submit" name="submit" size="1" style="height: 51px; width: 143px" tabindex="502" type="submit" value="Submit" /></span></div>
</div>

<div class="af-element privacyPolicy" style="text-align: center">
<div class="af-clear">&nbsp;</div>
</div>
</div>

<div class="af-footer" id="af-footer-1991411101">
<div class="bodyText">
<p>&nbsp;</p>
</div>
</div>
</div>

<div style="display: none"><img alt="" src="https://forms.aweber.com/form/displays.htm?id=jJycjCyMjIwMjA==" /></div>
</form>
<script type="text/javascript">
<!--
(function() {
var IE = /*@cc_on!@*/false;
if (!IE) { return; }
if (document.compatMode && document.compatMode == 'BackCompat') {
if (document.getElementById("af-form-1991411101")) {
document.getElementById("af-form-1991411101").className = 'af-form af-quirksMode';
}
if (document.getElementById("af-body-1991411101")) {
document.getElementById("af-body-1991411101").className = "af-body inline af-quirksMode";
}
if (document.getElementById("af-header-1991411101")) {
document.getElementById("af-header-1991411101").className = "af-header af-quirksMode";
}
if (document.getElementById("af-footer-1991411101")) {
document.getElementById("af-footer-1991411101").className = "af-footer af-quirksMode";
}
}
})();
-->
</script><!-- /AWeber Web Form Generator 3.0.1 -->

<p align="center">&nbsp;</p>
</body>
</html>


--------------------


View » | Reply »

]]>
Fri, 15 Sep 2017 17:51:38 GMT http://www.elated.com/forums/topic/6375#post26828
Re: Inline Style Of A Slider Doesn't Change Permanently http://www.elated.com/forums/topic/6373/#post26827 From: leandros21


Any idea?

--
To be or not to be

View » | Reply »

]]>
Fri, 15 Sep 2017 17:17:01 GMT http://www.elated.com/forums/topic/6373#post26827
Neophyte JS seeking help to complete exercise http://www.elated.com/forums/topic/6374/#post26826 From: aury


I'm learning JS and I have to do the following exercise, something I wrote, though incorrect, the important thing is to try it. Now, if someone can kindly help me to understand better how to properly complete exercise, so to understand and learn. At some points I'm locked up, I wrote the pseudocode, but I do not know how to turn it into code, I've also made syntax mistakes, but as I said I'm learning js alone and forum communities are my only support.

The first problem is in the first function. I'm not sure I developed it properly, both as a reasoning and as a syntax. to see console what was coming out I had written off the function:
calculateFoodOrder ();
It tells me that tokens are missing.


Code:
--------------------
/**
* This function should calculate the total amount of pet food that should be
* ordered for the upcoming week.
* @param numAnimals the number of animals in the store
* @param avgFood the average amount of food (in kilograms) eaten by the animals
* each week
* @return the total amount of pet food that should be ordered for the upcoming
* week, or -1 if the numAnimals or avgFood are less than 0 or non-numeric
*/
function calculateFoodOrder(numAnimals, avgFood) {
var numAnimals = 10;
var avgFood = numAnimals/7;
var total = avgFood*7;

if (Number(numAnimals || avgFood) < 0) and (isNaN(numAnimals || avgFood)){
console.log(-1);
}

return total;
}
calculateFoodOrder();
--------------------


The second is number 2 function.
Exercise says this function determines which day of the week had the most number of people visiting the pet store.
I wrote an array with the days of the week, a cycle for returning the days of the week and an if statment.

I know I'm wrong, I did not understand how to use the prototype for input that is an array of Weekday objects, which are created using the prototype function defined below, and how to determine which day has more traffic other days.


Code:
--------------------
/**
* Determines which day of the week had the most number of people visiting the
* pet store. If more than one day of the week has the same, highest amount of
* traffic, an array containing the days (in any order) should be returned.
* (ex. ["Wednesday", "Thursday"]). If the input is null or an empty array, the function
* should return null.
* @param week an array of Weekday objects
* @return a string containing the name of the most popular day of the week if there is only one most popular day, and an array of the strings containing the names of the most popular days if there are more than one that are most popular
*/
function mostPopularDays(week) {
week = [Monday,Tuesday, Wednesday, Thursday, Friday,Saturday, Sunday];
var weekdays = "";

for (i=0; i<week.length; i++) {
weekdays += week[i] + "<br>";
}

if (typeof week[i] === [] || week[i] === null) {
return null;
}

/*if there is only one most popular day return "dayname";
if there are more days than one that are most popular
return ["dayname","dayname","dayname"]*/

}

/**
* A prototype to create Weekday objects
*/
function Weekday (name, traffic) {
this.name = name;
this.traffic = traffic;
}
--------------------


In the development of the third function I did not understand how to return an array of objects that contain the animals' information, or an empty array if the array's lengths are unequal or zero, or if any array is null.


Code:
--------------------
/ **
* Given three arrays of equal length containing information about a list of
* animals - where names[i], types[i], and breeds[i] all relate to a single
* animal - return an array of Animal objects constructed from the provided
* info.
* @param names the array of animal names
* @param types the array of animal types (ex. "Dog", "Cat", "Bird")
* @param breeds the array of animal breeds
* @return an array of Animal objects containing the animals' information, or an
* empty array if the array's lengths are unequal or zero, or if any array is null.
*/
function createAnimalObjects(names, types, breeds) {
names = ["Lola", "Joy", "Elohim"];
types = ["Dog", "Cat", "Bird"];
breeds = ["Labrador", "Siamese", "Falco"];

return {
Animal = [["Lola", "Joy", "Elohim"], ["Dog", "Cat", "Bird"], ["Labrador", "Siamese", "Falco"]];
}
}

/**
* A prototype to create Animal objects
*/
function Animal (name, type, breed) {
this.name = name;
this.type = type;
this.breed = breed;
}
--------------------

Thanks!!

[Edited by aury on 15-Sep-17 08:05]

--
Aurora Ruggieri

View » | Reply »

]]>
Fri, 15 Sep 2017 07:39:48 GMT http://www.elated.com/forums/topic/6374#post26826
Inline Style Of A Slider Doesn't Change Permanently http://www.elated.com/forums/topic/6373/#post26825 From: leandros21


There's a default div's max-width 335.16px and when visitors click on an icon this max-width becomes 100% using jquery.
The problem is that when somebody clicks on the arrows to change the slide, max-width becomes again 335.16px.

Is there any way to change PERMANENTLY the max-width of the specific div?
The link to the test site is: http://www.onlineforextradingaccount.com/vangelis/

[Edited by leandros21 on 14-Sep-17 14:30]

--
To be or not to be

View » | Reply »

]]>
Thu, 14 Sep 2017 20:30:28 GMT http://www.elated.com/forums/topic/6373#post26825
Re: Javascript question - which variable? http://www.elated.com/forums/topic/6367/#post26822 From: chrishirst


"Are there any experienced developers here?"

Sure there are, but do we all have the time to debug somebody else's compressed code is an entirely different matter.

--
Chris.
So long, and thanks for all the fish.
http://webmaster-talk.eu/


View » | Reply »

]]>
Thu, 14 Sep 2017 01:08:49 GMT http://www.elated.com/forums/topic/6367#post26822
Re: spans and inline style http://www.elated.com/forums/topic/6371/#post26821 From: chrishirst


"span" and "inline style" are not even close to being equal.

A span is an HTML inline level container.

"inline style" refers to specifying the CSS in the style attribute of an element rather than in a style sheet.

"inline style element" is not even a meaningful term used in HTML or CSS.

And using 'inline styles' is a laborious and inflexible way of presentation. As such it should be used very, very sparingly, if at all.

--
Chris.
So long, and thanks for all the fish.
http://webmaster-talk.eu/


View » | Reply »

]]>
Thu, 14 Sep 2017 00:57:20 GMT http://www.elated.com/forums/topic/6371#post26821
Re: HTML Icon font awesome http://www.elated.com/forums/topic/6368/#post26820 From: chrishirst


Nothing in this;


Code:
--------------------<i class="fa fa-pinterest-p" aria-hidden="true"></i> --------------------


Has anything to do with icons or images.

--
Chris.
So long, and thanks for all the fish.
http://webmaster-talk.eu/


View » | Reply »

]]>
Thu, 14 Sep 2017 00:47:08 GMT http://www.elated.com/forums/topic/6368#post26820
Arrows don't show http://www.elated.com/forums/topic/6372/#post26819 From: leandros21


Hi, i have a wp custom site and i wanted to add a clickable icon, when the visitor clicks on it the slideshow be expanded(larger width+height).
I tried a lot of times to do it but without success. Can you help please?

The link to the test site is: http://www.onlineforextradingaccount.com/vangelis/


PS: The right slideshow

--
To be or not to be

View » | Reply »

]]>
Wed, 13 Sep 2017 10:05:02 GMT http://www.elated.com/forums/topic/6372#post26819