|
okay cool, thanks.
i mean i'm not totally new new like i didn't start yesterday. i've coded some in college but that was a c++ course, and then of course there's resources like khan academy which only teach so much you know?
i think embarking on an ambitious project is okay if there's help around, which clearly there is since people that know what they're doing like you are here to respond haha. i'm not in a rush but i do want this website to look simple, neat, and clean, so some of the traditional website styles aren't exactly my taste.
plus when all is said and done, i think that this is probably going to be a life-long project that i'm going to focus on, so like it's my first and my last? unless i branch out in the future, but yeah. i want to get it right the first time, even if it takes a little less than forever =]
|
|
|
|
|
It's actually straightforward enough - no need to go the whole SPA route.... IMO too much of web programming these days is all about using sledgehammers to crack nuts.
Simply wrap your image-button and your registration form in div tags, adn set that of the reg form to be hidden to start with.
<div style="display:none;" id="reg-form">
then, on the user clicking the image call a JavaScript function that reverses the hidden attributes of both divs.
That's the general principle, anyway.
|
|
|
|
|
thanks, but i have no idea for what the code is after all that stuff you said, haha. what is the code for hidden to start with? and also how do i reverse the hidden attibutes?
|
|
|
|
|
With all due respect then, I think perhaps you need to start with some basics before worrying about building a site.... http://www.w3schools.com/[^] is a good reference place for starting out.
However - below is a very basic page showing the essence of what you're after - but don't expect me or anyone else here to do your work for you. Learn what you can, try things, and ask questions on specific things you get stuck on.
<html>
<head>
<title></title>
<style type="text/css">
.show {
display:inline;
top:0;
left:0;
width:100%;
height:100%;
}
.noshow {
display:none;
}
.handy {
cursor:pointer;
}
</style>
<script type="text/javascript">
function enterSite() {
document.getElementById("splash").className = "noshow";
document.getElementById("login").className = "show";
}
</script>
</head>
<body>
<div id="splash">
<img src="relative path to image" onclick="enterSite()" alt="Click to enter site" class="handy" />
</div>
<div id="login" class="noshow">
<h2>Log in here</h2>
</div>
</body>
</html>
|
|
|
|
|
|
Just remove that value from the textarea. Notify the user of these actions like,
<p>Please do not enter the following in the textarea, they will be removed.</p>
<ul>
<li>@</li>
<li>dotcom</li>
<li>.com</li>
<li>dot</li>
</ul>
<textarea placeholder="Message..."
name="message_content" id="message_content"
style="width:100%;" rows="9"></textarea>
Now once user has submitted it, you can remove them using, (well if jQuery)
var val = $('#message_content').val().replace('dotcom', '')
.replace('dot', '')
.replace('@', '')
.replace('.com', '')
Another method is also available, in which you simply ignore that input. For example, if user presses "@" key. You ignore the input by using "return false;".
$('#message_content').keydown(function (e) {
if(e.which == code_for_@) {
return false;
}
});
But I will personally recommend the above provided method, user would know what he is doing and if he enter that data, it will be removed from input.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Hi. I need difference between givendate and datetime.now in javascript.
I don't want to make it a clumsy seperating date, month, year from dates and then getting difference.
I'm looking for a solution that can get the result in 1 or 2 steps.
|
|
|
|
|
|
Is there a way to use toUpperCase and length on an array of 20 elements without typing each element out in an array?
|
|
|
|
|
What are you trying to accomplish?
|
|
|
|
|
Sure, like this
> var array = ["Eeny", "meeny", "miny", "moe"];
> array.forEach((i) => { console.log(`${i.toUpperCase()} ${i.length}`); });
EENY 4
MEENY 5
MINY 4
MOE 3
Using ES6 for brevity.
modified 6-Apr-21 21:01pm.
|
|
|
|
|
I'm a student and have an assignment where we are supposed to prompt for 20 names and then use an Array to output the names. I was wondering if there is a shorter way to write the code for the 20 name prompts? Right now I am writing a var statement for each name prompt. And then how do I get the names in the Array?
|
|
|
|
|
|
Have they not covered for loops yet?
var myArray = [];
for(var i = 0;i < 20;i++)
{
myArray[i] = NameGettingFunction();
}
This is just about the most basic iterative construct, and it will serve you always.
Or you can have 20 different prompt vars. The point of most CS classes is to get you to think about possible solutions. I get that the toolbox is a little empty right now, but learning some basic principles like iteration and recursion will get you much closer to the place that you need to be.
|
|
|
|
|
No we haven't gotten to loops yet. He said we were going to go back to this assignment later for loops. Thanks
|
|
|
|
|
That works for the prompts, but how do I get the names to output? Right now I am getting numbers with document.write.
|
|
|
|
|
Exactly the same way, but with your output instead.
|
|
|
|
|
Hi all,
I have a website form and it pops up a certain alert when the user enters some specific value in a text box. Now, I want to quantify those alerts, set up a counter and store that value in a SQL db table. Any ideas/examples on this would be much appreciated. Thanks!
|
|
|
|
|
You'll need to modify the function that pops up the alert to also call a handler of some sort, using an AJAX call, on your server to do this. SO you'll require some kind of server-side trechnology, whether it be .NET, php or whatever.
|
|
|
|
|
Hello Team
I will try with the help of colorize but it not work properly.
My basic problem is that i want to do change color of image when user select color tone tab then color tab will open if user click on a particular color on this tab the image color will change please help me
Thanks & Regards
Rajiv Rahi
|
|
|
|
|
Hi,
i am trying to use pyQT and python to get the dynamic content from a web page. The problem is that i still only get the static content. What could be wrong with the code below?
Code is based on this link: https://impythonist.wordpress.com/2015/01/06/ultimate-guide-for-scraping-javascript-rendered-web-pages/[^]
import sys
import time
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from PyQt4.QtWebKit import *
from lxml.html import fromstring, tostring, iterlinks
class Render(QWebPage):
def __init__(self, url):
self.app = QApplication(sys.argv)
QWebPage.__init__(self)
self.loadFinished.connect(self._loadFinished)
self.mainFrame().load(QUrl(url))
self.app.exec_()
print("inside 1")
def _loadFinished(self, result):
self.frame = self.mainFrame()
self.app.quit()
print("inside 2")
url = 'http://www.somepage.com'
r = Render(url)
print("inside 3")
print("Sleeping..")
time.sleep(5)
print("Sleeping done")
result = r.mainFrame().toHtml()
print(result.encode('utf-8'))
I added the sleep(5) to ensure that the dynamic content has time to load but is does not help.
Why doesn't the r.mainFrame() contain the valid dynamically created page contents? Is it not updated after the pageloaded event?
Regards
|
|
|
|
|
|
Hi all, I am trying to call to a web service in a function but I get 2 errors that I cannot figure out the cause.
The first error is "Uncaught ReferenceError: distance is not defined" and the second error is "Uncaught TypeError: callback is not a function".
The following is my code snippet
function GetClosestRestaurant(location, distance, results, callback) {
_lat = location.lat();
_lng = location.lng();
var jdata = { lat: _lat, lng: _lng, distance: distance, results:results };
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
if (xhr.readyState < 4) {
return;
}
if (xhr.status !== 200) {
return;
}
};
xhr.open('Get', 'http://http://localhost:21311/myService.asmx/GetClosestPlace', true);
xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
xhr.send(JSON.stringify(jdata));
callback(xhr.responseText);
}
GetClosestRestaurant(location, distance, results, DisplayPlace);
function GetAddress(addr, callback) {
var location = "Some Location";
var distance = "5";
var results = "10";
callback(location, distance, results);
}
function GetLatLong() {
var address = "123 SomeStreet, SomeCity, SomeState";
GetAddress(address, GetClosestRestaurant)
}
I made sure that the variables location, distance, and results all have values by doing alert on all of them inside of the GetClosestRestaurant() function definition.
when I call GetClosestRestaurant() however, I get the error as stated above. Any help is greatly appreciated, thanks in advance.
modified 15-Sep-15 14:48pm.
|
|
|
|
|
MadDashCoder wrote: when I call GetClosestPlace() however, I get the error as stated above.
Well, there's clearly an error in your GetClosestPlace function. Since you haven't shown that function, we can't tell you what the error is.
The code you have posted has several problems:
xhr.open('Get', 'http://http://...
- double "http://" in the URL.GetClosestRestaurant(location, distance, results, DisplayPlace);
- location , distance , results and DisplayPlace are not defined at the point where you are calling this function.GetLatLong calls GetAddress , passing GetClosestRestaurant as the callback parameter. GetAddress then passes three parameters to the callback function, but your GetClosestRestaurant function requires four parameters.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi, thanks for replying. I have made changes to my code based on your suggestion and decided to use global variables as shown below.
_lat, _lng, _location, distance, results
function GetClosestRestaurant(_location, distance, results, callback) {
_lat = _location.lat();
_lng = _location.lng();
var jdata = { lat: _lat, lng: _lng, distance: distance, results:results };
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
if (xhr.readyState < 4) {
return;
}
if (xhr.status !== 200) {
return;
}
};
xhr.open('Get', "http://localhost:21311/myService.asmx/GetClosestPlace", true);
xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
xhr.send(JSON.stringify(jdata));
callback(xhr.responseText);
}
GetClosestRestaurant(_location, distance, results, DisplayClosestRestaurant);
function GetAddress(addr, callback) {
location = "Some Location";
distance = "5";
results = "10";
callback(location, distance, results);
}
function GetLatLong() {
var address = "123 SomeStreet, SomeCity, SomeState";
GetAddress(address, GetClosestRestaurant)
}
Now I am getting the error "Uncaught TypeError: Cannot read property 'lat' of undefined" inside of the GetClosestRestaurant() function. I can't figure out why I am getting this error, since I get the value that I'm supposed to get when I do an alert passing in _lat. The other error I'm getting is "Failed to load resource: the server responded with a status of 500 (Internal Server Error)".
I'm not sure if it's related to the first error since I made sure the variable names passed to the web service match the names of the parameters inside the web service function being called.
Thanks again for your help.
modified 15-Sep-15 16:41pm.
|
|
|
|
|