[Solved] javascript array text substitution

Okay, so this works: http://jsfiddle.net/4ax7mvL4/5/ var a = []; a[0] = “Hi may name is ‘%s’ and my brother is ‘%d'”; a[1] = “John”; a[2] = “David”; var final = a[0]; for(var i = 1; i < a.length; i++) { final = final.replace(/%[sd]/, a[i]); } alert(final); But I’m sure there are people out there that … Read more

[Solved] My login php script that redirects to each user page [closed]

Sounds like you are wanting to use Query Strings. There are plenty of resources online to help you out. Here are some examples: https://lightignite.com/help-your-customers-fill-out-web-forms-with-url-query-strings/ http://richard.jp.leguen.ca/tutoring/soen287/tutorials/query-strings-and-forms/ 0 solved My login php script that redirects to each user page [closed]


Like this using inline object var object = { method: function() { console.log(‘this is method’); } }; object.method(); using contructor: function Foo() { this.method = function() { console.log(‘this is method’); }; } var object = new Foo(); object.method(); using prototype: function Foo() {} Foo.prototype.method = function() { console.log(‘this is method’); }; var object = new … Read more

[Solved] Why are images duplicated with append()?

From the source code on your website, it seems that you might be attempting to remove images from the container before appending new images: $(‘#project_images’).html(”); However, that selector uses an underscore while the actual element uses a hyphen: <div id=”project-images”> Also, you are clearing the contents after appending images rather than before. I suggest using … Read more

[Solved] how to print all words the end with ed? [closed]

The difference between the arrays: The difference between double[] array = new double[a.Count – 2]; and double[] array = new double[a.Count]; is the length of the array you are declaring. When you are passing a integer value into the constructor of your new array that is the length your array will be initialized with. Notes … Read more

[Solved] My rounding impossible (Javascript and PHP)

Maybe this? <?php $num = ‘49.82’; $new_num = $num; $hundredth = substr($num, -1, 1); switch($hundredth) { case ‘0’: break; case ‘1’: $new_num = ($new_num – 0.01); break; case ‘2’: $new_num = ($new_num – 0.02); break; case ‘3’: $new_num = ($new_num – 0.03); break; case ‘4’: $new_num = ($new_num – 0.04); break; case ‘5’: break; case … Read more

[Solved] how can i do the following on my website? [closed]

try this but im not sure it works. JSFiddle – link EDIT: Html <body> <div id=”box”> <a href=”https://stackoverflow.com/questions/23628933/javascript:show();” >Link</a> </div> <div id=”box2″> <iframe src=”” id=”frame” width=100% height=100%></iframe> <div id=”close”><input type=”button” onclick=”closeIframe()” value=”X” /></div> </div> </body> Javascript function show() { box= document.getElementById(“box”); box.style.visibility=”hidden”; frame=document.getElementById(“box2″); frame.style.visibility=”visible”; } function closeIframe() { box2=document.getElementById(“box2″); box2.style.visibility=”hidden”; box= document.getElementById(“box”); box.style.visibility=”visible”; } CSS … Read more

[Solved] Basic Java Initialize concept [closed]

If you didn’t initialize you wouldn’t be able to access the objects property (Because it would be undefined). var test = { definedProperty : “Hello” }; alert(test.definedProperty); alert(test.undefinedProperty); http://jsfiddle.net/3cWzw/ 1 solved Basic Java Initialize concept [closed]

[Solved] about javascript comment specification

This happens because <!– behaves similar to //, i.e. it comments out only everything after it on the same line. JS doesn’t recognize the closing part of the HTML’s comment block (–>). Looks like you even know this, since you’ve commented it out in your snippet. Originally this commenting method was used to hide a … Read more

[Solved] How to connecting the function, createElement and random? [closed]

As per my understanding, you are trying to create ‘n’ no.of random buttons as of in the innerHTML of #demo. If so you need to loop it. Try this function myFunction() { var num = 5; document.getElementById(“demo”).innerHTML = Math.floor(Math.random() * num) var noOfButtons = document.getElementById(“demo”).innerHTML; for (var i = 0; i < noOfButtons; i++) { … Read more