#get id javascript
Explore tagged Tumblr posts
orcelito · 2 months ago
Text
Working on my javascript for my web page. Turns out I have the perfect kind of setup to accomplish some of the project requirements, specifically with even handlers and user interactions
My website, conceptually, will load a different employee details page depending on what employee name is clicked on. But I need to load it dynamically (instead of hard-coding it) so that the user can add or delete employees & it'll be able to still load the relevant shit.
So! Only one employee details page, but depending on how it's loaded, it'll load a different employee's information. Still working on getting down Exactly how to do it (I'm thinking using URL parameters that'll read a different object depending on what ID is used)
It's entirely doable. In fact, it's probably extremely common to do in web pages. No one wants to hard-code information for every new object. Of course not. And thus the usefulness of dynamic javascript stuff.
I can do this. I can very much do this.
#speculation nation#i wasnt very good when i got home and i read fanfic for a while#then took a nap. and now im up again and Getting To Work.#i dont have to have this 100% perfect for final submission just yet. bc final submission isnt today.#but i need to have my final presentation over my thing done by noon (11 hours from now)#and im presenting TODAY. and part of that will be giving a live demo of my project website#so. i need to have all of the core functionality of my website down at the Very Least#might not be perfect yet. but by god if im gonna show up to my presentation with my website not working.#i need to have the employee list lead to employee details with personalized information displayed per employee#i need to create an add employee field that will Actually add an employee. using a form.#and that employee will need to show up on the list and have a new id and everything. the works.#need to set it up so that employees can be deleted. shouldnt be too much extra.#and it would be . interesting. to give an actual 'login' pop-up when someone clicks on the login button#with some kind of basic info as the login parameters. this cant be that hard to code.#the project requirements are: implement 5 distinct user interactions using javascript. at least 3 different eventhandlers#at least 5 different elements with which interaction will trigger an event handler. page modification & addition of new elements to pages#3 different ways of selecting elements. one selection returning collection of html elements with customized operations on each...#hm. customized operations on each... the example given is a todo list with different styles based on if an item is overdue or not#i wonder if my personalized detail page loading would count for this... i also have some extra info displayed for each#but i specifically want the employees to be displayed in the list uniformly. that's kinda like. The Thing.#actually im poking around on my web pages i made previously and i do quite enjoy what i set up before.#need to modify the CSS for the statistics page and employee details to make it in line with what i actually wanted for it#maybe put a background behind the footer text... i tried it before & it was iffy in how it displayed...#but it looks weird when it overlaps with a page's content. idk that's just me being particular again.#theres also data interchange as a requirement. but that should be easy if i set an initial employee list as a json file#good god im going to have to think of so much extra bullshit for these 10 made up employees#wah. this is going to be a lot of work. but. im going to do it. i just wont get very much sleep tonight.#that's ok tho. ive presented under worse conditions (cough my all nighter when i read 3gun vol 10 and cried my eyes out)#and this is going to be the last night like this of my schooling career. the very last one.#just gotta stay strong for one more night 💪💪💪
6 notes · View notes
bobzora · 1 year ago
Text
crazy to me that the default rpgm 'select item' dialogue does not show item descriptions
3 notes · View notes
fruiteggsaladit · 6 days ago
Text
Halfway through the bane of my existence SQL tutorial if I can simply get through the tutorial and then get used to using it and then seeing how that's relevant to javascript or what have ye.
0 notes
sanchoyo · 8 months ago
Text
OH another thing I want to do more next year is join more free zines/projects like that. like I've found the most enjoyment with those bc they feel lower pressure than the for-profit ones, which is very good for how nervous I get otherwise ajkdhsfkj. i love a small project
0 notes
roseband · 2 years ago
Text
we fully got my automation system working at my job now (which... literally follows the same way i automate my gifs lmfao... mixed with an additional step that uses excel)
sooooooo since it's yearly review season I'd better get a huge raise and bonus tbh
0 notes
codingquill · 2 years ago
Text
JavaScript Fundamentals
I have recently completed a course that extensively covered the foundational principles of JavaScript, and I'm here to provide you with a concise overview. This post will enable you to grasp the fundamental concepts without the need to enroll in the course.
Prerequisites: Fundamental HTML Comprehension
Before delving into JavaScript, it is imperative to possess a basic understanding of HTML. Knowledge of CSS, while beneficial, is not mandatory, as it primarily pertains to the visual aspects of web pages.
Manipulating HTML Text with JavaScript
When it comes to modifying text using JavaScript, the innerHTML function is the go-to tool. Let's break down the process step by step:
Initiate the process by selecting the HTML element whose text you intend to modify. This selection can be accomplished by employing various DOM (Document Object Model) element selection methods offered by JavaScript ( I'll talk about them in a second )
Optionally, you can store the selected element in a variable (we'll get into variables shortly).
Employ the innerHTML function to substitute the existing text with your desired content.
Element Selection: IDs or Classes
You have the opportunity to enhance your element selection by assigning either an ID or a class:
Assigning an ID:
To uniquely identify an element, the .getElementById() function is your go-to choice. Here's an example in HTML and JavaScript:
HTML:
<button id="btnSearch">Search</button>
JavaScript:
document.getElementById("btnSearch").innerHTML = "Not working";
This code snippet will alter the text within the button from "Search" to "Not working."
Assigning a Class:
For broader selections of elements, you can assign a class and use the .querySelector() function. Keep in mind that this method can select multiple elements, in contrast to .getElementById(), which typically focuses on a single element and is more commonly used.
Variables
Let's keep it simple: What's a variable? Well, think of it as a container where you can put different things—these things could be numbers, words, characters, or even true/false values. These various types of stuff that you can store in a variable are called DATA TYPES.
Now, some programming languages are pretty strict about mentioning these data types. Take C and C++, for instance; they're what we call "Typed" languages, and they really care about knowing the data type.
But here's where JavaScript stands out: When you create a variable in JavaScript, you don't have to specify its data type or anything like that. JavaScript is pretty laid-back when it comes to data types.
So, how do you make a variable in JavaScript?
There are three main keywords you need to know: var, let, and const.
But if you're just starting out, here's what you need to know :
const: Use this when you want your variable to stay the same, not change. It's like a constant, as the name suggests.
var and let: These are the ones you use when you're planning to change the value stored in the variable as your program runs.
Note that var is rarely used nowadays
Check this out:
let Variable1 = 3; var Variable2 = "This is a string"; const Variable3 = true;
Notice how we can store all sorts of stuff without worrying about declaring their types in JavaScript. It's one of the reasons JavaScript is a popular choice for beginners.
Arrays
Arrays are a basically just a group of variables stored in one container ( A container is what ? a variable , So an array is also just a variable ) , now again since JavaScript is easy with datatypes it is not considered an error to store variables of different datatypeslet
for example :
myArray = [1 , 2, 4 , "Name"];
Objects in JavaScript
Objects play a significant role, especially in the world of OOP : object-oriented programming (which we'll talk about in another post). For now, let's focus on understanding what objects are and how they mirror real-world objects.
In our everyday world, objects possess characteristics or properties. Take a car, for instance; it boasts attributes like its color, speed rate, and make.
So, how do we represent a car in JavaScript? A regular variable won't quite cut it, and neither will an array. The answer lies in using an object.
const Car = { color: "red", speedRate: "200km", make: "Range Rover" };
In this example, we've encapsulated the car's properties within an object called Car. This structure is not only intuitive but also aligns with how real-world objects are conceptualized and represented in JavaScript.
Variable Scope
There are three variable scopes : global scope, local scope, and function scope. Let's break it down in plain terms.
Global Scope: Think of global scope as the wild west of variables. When you declare a variable here, it's like planting a flag that says, "I'm available everywhere in the code!" No need for any special enclosures or curly braces.
Local Scope: Picture local scope as a cozy room with its own rules. When you create a variable inside a pair of curly braces, like this:
//Not here { const Variable1 = true; //Variable1 can only be used here } //Neither here
Variable1 becomes a room-bound secret. You can't use it anywhere else in the code
Function Scope: When you declare a variable inside a function (don't worry, we'll cover functions soon), it's a member of an exclusive group. This means you can only name-drop it within that function. .
So, variable scope is all about where you place your variables and where they're allowed to be used.
Adding in user input
To capture user input in JavaScript, you can use various methods and techniques depending on the context, such as web forms, text fields, or command-line interfaces.We’ll only talk for now about HTML forms
HTML Forms:
You can create HTML forms using the &lt;;form> element and capture user input using various input elements like text fields, radio buttons, checkboxes, and more.
JavaScript can then be used to access and process the user's input.
Functions in JavaScript
Think of a function as a helpful individual with a specific task. Whenever you need that task performed in your code, you simply call upon this capable "person" to get the job done.
Declaring a Function: Declaring a function is straightforward. You define it like this:
function functionName() { // The code that defines what the function does goes here }
Then, when you need the function to carry out its task, you call it by name:
functionName();
Using Functions in HTML: Functions are often used in HTML to handle events. But what exactly is an event? It's when a user interacts with something on a web page, like clicking a button, following a link, or interacting with an image.
Event Handling: JavaScript helps us determine what should happen when a user interacts with elements on a webpage. Here's how you might use it:
HTML:
<button onclick="FunctionName()" id="btnEvent">Click me</button>
JavaScript:
function FunctionName() { var toHandle = document.getElementById("btnEvent"); // Once I've identified my button, I can specify how to handle the click event here }
In this example, when the user clicks the "Click me" button, the JavaScript function FunctionName() is called, and you can specify how to handle that event within the function.
Arrow functions : is a type of functions that was introduced in ES6, you can read more about it in the link below
If Statements
These simple constructs come into play in your code, no matter how advanced your projects become.
If Statements Demystified: Let's break it down. "If" is precisely what it sounds like: if something holds true, then do something. You define a condition within parentheses, and if that condition evaluates to true, the code enclosed in curly braces executes.
If statements are your go-to tool for handling various scenarios, including error management, addressing specific cases, and more.
Writing an If Statement:
if (Variable === "help") { console.log("Send help"); // The console.log() function outputs information to the console }
In this example, if the condition inside the parentheses (in this case, checking if the Variable is equal to "help") is true, the code within the curly braces gets executed.
Else and Else If Statements
Else: When the "if" condition is not met, the "else" part kicks in. It serves as a safety net, ensuring your program doesn't break and allowing you to specify what should happen in such cases.
Else If: Now, what if you need to check for a particular condition within a series of possibilities? That's where "else if" steps in. It allows you to examine and handle specific cases that require unique treatment.
Styling Elements with JavaScript
This is the beginner-friendly approach to changing the style of elements in JavaScript. It involves selecting an element using its ID or class, then making use of the .style.property method to set the desired styling property.
Example:
Let's say you have an HTML button with the ID "myButton," and you want to change its background color to red using JavaScript. Here's how you can do it:
HTML: <button id="myButton">Click me</button>
JavaScript:
// Select the button element by its ID const buttonElement = document.getElementById("myButton"); // Change the background color property buttonElement.style.backgroundColor = "red";
In this example, we first select the button element by its ID using document.getElementById("myButton"). Then, we use .style.backgroundColor to set the background color property of the button to "red." This straightforward approach allows you to dynamically change the style of HTML elements using JavaScript.
400 notes · View notes
weepingwitch · 9 months ago
Text
i think an easy important step to Knowing More about websites and shit is to start using the element inspector / source code viewer / js console in the browser. like fake screenshots are so easy to make by editing the page, and you'll get used to removing/disabling those "subscribe to continue reading" popups and shit. you'll be a more proficient user of your existing adblock tools if you understand what kind of elements to block, or how to identify the specific class/id names. you can start to look at what cookies/cached data a website is storing. like bc of how javascript is executed and CSS rendered client side, you have a lot more control/insight over how websites appear and function. u can make hard-to-read text into a better color or font, or give things solid backgrounds. inspect those elements!
53 notes · View notes
thrill-seeker-vn · 1 year ago
Text
3 Game/Coding Resources!
I wanted to put together a few resources I found for people who might be planning to make games, or might be looking to learn coding!
The first resource is for anyone looking to learn how to code, build a portfolio, and get Certifications:
This is something I've recently been using myself and I can attest that it is an excellent resource!! They have many different paths you can learn, and right now I’m on the Responsive Web Design Certification. You can learn HTML and CSS, in order to create responsive pages. It teaches you through projects, where it breaks down different parts of the coding language and shows you how to use it. Some projects are optional, and some you have to complete in order to earn your certification. Certification projects don’t have instructions, only a rubric of what the project needs to be able to do, but you can learn all those skills in the optional projects! They also have Javascript, Frontend Development, Information Security… the list goes on! The website is run by a really cool non profit. I definitely recommend giving it a try!!
2. The second is for game developers who are looking for background music:
@/茶葉のぎか (Nogika Chaba on twitter) makes some really awesome 8bit-sounding BGM! And a lot of it is free for commercial/non commercial use!!
Make sure to check the description (you can translate to your language) for their policies. Many of their videos are tagged #freeBGM, which if you check their Pixiv Fanbox terms of service (in the desc of each video, please do check it before you use it) states that you are able to use the music in commercial/non commercial works:
Tumblr media
2. The third resource is for students:
Whether you're a university student, college, high school, or elementary, Github gives you free Github pro, as well as a curation of free offers! You do need a piece of student ID (proof that you indeed belong to an institution, eg. report card, student card, etc), but it has a host of offers. Microsoft offers free cloud training through this, there are multiple offers for learning a new coding language for free (eg. Codedex free 6-month subscription, which will also give you certificates once completed), you can get free domain names, the list goes on! If you are a student, I highly recommend that you give it a try, since it's 100% free!
18 notes · View notes
megabuild · 1 year ago
Text
okay im not making this now because im shit at coding but im putting it here because ive been thinking about this for ages and i just had a little lightbulb moment. i love wordle and heardle and daily games in that vein and ive wanted to make a mcyt-based one for ages but had no idea what id do but now im thinking something a la d'ohrdle where you would get a quote and have to guess the episode/stream it's from. currently thinking of a 3rd life+ based one since that's what i'm into and because there is *so* much to scrape from what with the multiple povs and seasons... i cant find any open source quote-based ones to play around with unfortunately, just audio ones, but if i ever get round to learning javascript properly i Will come back to this one
22 notes · View notes
trickinabucket · 2 months ago
Text
i made this gay dumb bullshit (affectionate)
Tumblr media
I couldn't immediately find some sort of node that allowed copying and pasting raw code with the click of a button, so I made one!
The icon is from fontawesome (so you can download a massive collection if u want) and can easily be replaced by another icon on the css page. The layout itself is fully customizable, but this one currently has classes added to the divs that automatically get themed with any jquery ui theme. It's resizable. All libraries you need don't need downloading, as google hosts jquery libraries and cdn hosts jquery ui themes. Pretty sure they also host fontawesome, but if they don't, you can get the links to the code on the fontawesome site.
What I'm most proud of is: You can have as many of them on the page as you want! The only limit is...well...ur computer? lol. What I mean by that is: copy and paste the divs that are a "blueprint", and the script will automatically add IDs/images necessary to keep everything all lined up. Every panel can be copied individually.
There's an indication as to whether copying was successful, as well.
Still have to do mobile testing, to see if the button works on devices, but after that, I'd be happy to share. It's not a plugin, per se (I still have yet to figure out how to make those), but I'm thinking abt making it into a regular ol Javascript function that you can still just plug in values.
Gonna take my afternoon nap firsttttt
3 notes · View notes
alycesutherland · 4 months ago
Text
Stuck: JavaScript file
My goal is to just make and API call in a JavaScript file and get the info in my terminal.
For some reason though, my token isn't working. I took a look at the documentation and figured I needed to use the client ID and secret to make a request for an access token. After adding that into my script file I'm still getting a error about needing valid user authentication.
The token I was using before w.as a temporary one in the Spoify dev website. So I can't hardcode that. So trying to figure out the right way to get that token :P
5 notes · View notes
kyanako5972 · 3 months ago
Text
I was able to retrieve the asks that disappeared!
So after I clicked the links in the emails about my asks, I was redirected to the old version of Tumblr. https://www.tumblr.com/blog/<blogname>/submissions?<postid>
I grabbed the post id and pasted it into the new formatted url:
https://www.tumblr.com/<blogname>/<postid>
And there it was!
For convenience, I wrote a snippet of Javascript that I could paste into the console to automatically redirect. (I wasn't able to get it to work as a tampermonkey script, though.)
``` const new_url = 'https://www.tumblr.com/<blogname>/'; let ask_id = window.location.search.slice(1); console.log("Tumblr ask redirect"); window.location.href = new_url+ask_id; ```
So I managed to clean up a few questions that way.
Tumblr media
6 notes · View notes
dragunsblood · 6 months ago
Text
after all that work to get some of the mods compatible it turns out that theres a part of it that breaks when you use it for any mod that uses geckolib (pretty much every animal i added) so i cant actually make the therian server :( id make a patch myself since the mod authors dont seem to be interested in fixing this issue (its been reported) but i dont know nearly enough javascript to do it sigh
5 notes · View notes
roseband · 2 years ago
Text
...
0 notes
jiraiposting · 2 months ago
Note
what uuup, chronicallyjirai here but sadly my blog is *also* a sideblog so anon it is.
depending on what you feel like doing w/ programming i HIGHLY recommend getting into the indie web/small web space, neocities is an incredible lil place where you can code your own website!
it's great programming practice for css/html/javascript and you *can* branch out into other areas from there for sure, i'm just lazy and stick to html bc it's all i know :p
idk tooo much about hacking/cybersecurity stuff beyond basic internet safety but i'd be certain there are people w/in that community that know more than me and can direct you from there :3
Yesss, ive been meaning to get into html to do something with my neocities acc. I just don't have the motivation to actually study lol
Neocities is so cool, there are many amazing ppl over there. Im just worried ill be considered creepy or something, im not very charming or talented so id just be asking weird programming questions lol
Thanks for the ask! I love asks!
2 notes · View notes
barbwritesstuff · 1 year ago
Note
Have you ever considered trying Ink/Inky from inklestudios for your games? It's was designed as middle-ware software meant for injecting into other games but as a coding (technically it's markup) language it's rather similar to ChoiceScript in ease of use/learning but with the versatility of Twine (since it exports into a html file and is compatible with Javascript + CSS) and can do choice-based interactive fiction pretty well (with an in-built save system like Twine or Ren'py to boot). The documentation for it is also fairly thorough too. Plus unlike ChoiceScript it has a open-sourced MIT license that allows for independent creators to create commercial games without needing to pay for a license to use it.
Though, it still suffers in the same category as Twine/Ren'py as opposed to ChoiceScript (not having a ready-to-go market to cater to) since it'll still fall under the self-publishing umbrella but I wanted to mention it for anyone who doesn't want to use ChoiceScript but may still be struggling with learning Twine. Especially since I don't think Ink/Inky gets much love despite it also being an excellent choice for choice-based IF (though I think that's more because it flies under the radar most of the time).
Ink or Inkle didn't used to have a downloadable IDE. Working entirely on a browser is not an option for me, because I'm a millennial, and I don't trust browsers not to do strange and sinister things.
And you shouldn't either. Browsers are dangerous places. Don't trust them.
I've heard rumours that Ink may have an app or IDE now. If so, that makes Ink a much more viable option for interactive game development. However, I haven't tried it, so I really can't say much more than that.
Thanks for the message, anon. Ink is certainly an option people should check out if they're thinking of making an interactive fiction game.
21 notes · View notes