Jason28 Posted November 25, 2013 Share Posted November 25, 2013 I have spent so many years trying to figure out javascript and just cannot learn it. Especially when all of the code is correct but it doesn't work. Anyway, I need a very simple javascript code that everyone here should know please... I want to pass two values via a url, to another spot on the same webpage. So like a url with javascript function (50,60) will change the values of the an iframe on that page from <iframe style="height: 50px, width:60px">. So I will pass the height and width values to the iframe on the page when I click on a url. Please provide full code thanks Quote Link to comment https://forums.phpfreaks.com/topic/284238-very-simple-javascript-need-to-pass-values-via-url/ Share on other sites More sharing options...
r3wt Posted November 25, 2013 Share Posted November 25, 2013 I have spent so many years trying to figure out javascript and just cannot learn it. Especially when all of the code is correct but it doesn't work. Anyway, I need a very simple javascript code that everyone here should know please... I want to pass two values via a url, to another spot on the same webpage. So like a url with javascript function (50,60) will change the values of the an iframe on that page from <iframe style="height: 50px, width:60px">. So I will pass the height and width values to the iframe on the page when I click on a url. Please provide full code thanks you want jquery buddy, search stackoverflow for keywords. also, this is not a help site. in general, people won't write code for you, but if you put forth the effort to try, your effort will be rewarded with our help. thanks, r3wt here's those keywords if you're lazy and want to search stack overflow and hack something together. we've all been there. pass value to html element parameters with jquery Quote Link to comment https://forums.phpfreaks.com/topic/284238-very-simple-javascript-need-to-pass-values-via-url/#findComment-1459910 Share on other sites More sharing options...
Jason28 Posted November 25, 2013 Author Share Posted November 25, 2013 (edited) Hmm I doubt I need jquery for that since I have seen javascript do that years before jquery or ajax was even invented. This is not a help site? It has been helping people for years. I cannot find my answer on stackoverflow, I have been searching for hours. I work 14 hours per day at my full time job and code after that so I am far from lazy. Edited November 25, 2013 by Jason28 Quote Link to comment https://forums.phpfreaks.com/topic/284238-very-simple-javascript-need-to-pass-values-via-url/#findComment-1459991 Share on other sites More sharing options...
Solution Jason28 Posted November 25, 2013 Author Solution Share Posted November 25, 2013 Ha I figured it out myself using W3schools and only one line of code thanks for nothing screw Jquery. Quote Link to comment https://forums.phpfreaks.com/topic/284238-very-simple-javascript-need-to-pass-values-via-url/#findComment-1459996 Share on other sites More sharing options...
codefossa Posted November 25, 2013 Share Posted November 25, 2013 (edited) Well, it's by far easier with jQuery if you want to pass form information or something you can use .serialize(). You could use .serializeArray() to keep things easier and cleaner. It sounds like all you want to do is use window.location and set it to something like "http://mysite.com/?var=this&var2=that". You can say "screw jQuery", but the truth is that it makes just about everything so much easier. in general, people won't write code for you, but if you put forth the effort to try, your effort will be rewarded with our help. That is the main thing you should have paid attention to from his post. If you want help, you should put some effort into trying it and show us that you have. Just coming and asking for code isn't going to get you very far. There's a freelance section for that stuff. Also, no. You don't need jQuery for anything. It makes things a hell of a lot easier though, and a lot of times lets you do much less work for the same or better result. You don't need a lawn mower to cut your grass. Scissors work, but it would be a pain in the ass. Edited November 25, 2013 by Xaotique Quote Link to comment https://forums.phpfreaks.com/topic/284238-very-simple-javascript-need-to-pass-values-via-url/#findComment-1460003 Share on other sites More sharing options...
Irate Posted November 25, 2013 Share Posted November 25, 2013 Well, it's by far easier with jQuery if you want to pass form information or something you can use .serialize(). You could use .serializeArray() to keep things easier and cleaner. It sounds like all you want to do is use window.location and set it to something like "http://mysite.com/?var=this&var2=that". You can say "screw jQuery", but the truth is that it makes just about everything so much easier. That is the main thing you should have paid attention to from his post. If you want help, you should put some effort into trying it and show us that you have. Just coming and asking for code isn't going to get you very far. There's a freelance section for that stuff. Also, no. You don't need jQuery for anything. It makes things a hell of a lot easier though, and a lot of times lets you do much less work for the same or better result. You don't need a lawn mower to cut your grass. Scissors work, but it would be a pain in the ass. Just to grab up the point of your last paragraph... jQuery makes everything easier, but if you're really, really, really (and I mean really) concerned about your page load and those few milliseconds it takes to load jQuery from Google APIs (or directly from code.jquery.com), then using vanilla JS is often the more straightforward approach (but nevertheless more verbose; it also doesn't provide very useful utility functions). Quote Link to comment https://forums.phpfreaks.com/topic/284238-very-simple-javascript-need-to-pass-values-via-url/#findComment-1460021 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.