my situation:
I have two pages, let them be Pagestart.html and PageFinish.html.
PageFinish.html contains a simple form with a textbox and I am not allowed to change this page.... :-(.
On Pagestart.html, I have a dynamic webpage, that receives data from a database and based on this data I have to change the textbox on PageFinish.html via JavaScript...
The scenario is, the user clicks on the link to PageFinish.html and with this I need a parameter containing javascript that is executed on the PageFinish.html site and does this job for me...
My Javascriptcode is fine and it is working if I execute it on the PageFinish.html page, but sending this code via the link is not possible.
Thank You!
Related
I'm trying to make a website with a sort of survey where the user picks one of 2 buttons with different text values and the website saves what value he picked and reloads the website giving the user 2 new values on the buttons. I already made the system for rolling new button values and reloading when one of them is picked but I cant figure out how to save data.
This is the current code I have:
function b1() {
data = document.getElementById("b1").innerHTML;
alert(data);
location.reload();
}
This function is called when one of the buttons is pressed (there is another one for the other button) and the data variable is what value is on the button.
Instead of alerting the data variable I want to be able to add 1 to a variable in a database which counts how many times this value was picked.
I already tried using the google sheets api but it did not work and just stopped the code from working.
I tried adding a .txt file and use js to edit it but since js is ran client side it cant edit server side files.
You can use google forms for that.
Usually if you want a custom solution you would need PHP.
Using external software like with an API you can get an easy solution without too much effort.
At the end of google forms when you have made your form, you have the option to share, and there you should click the "<>" tab to copy the iframe into your HTML.
I want to scrape data from a website within my java-application. The data I want to collect is inside a html-table-element. I tried two different methods:
I tried to load the website with a BufferedReader into a String and collect the data from the String.
I tried to use Jsoup to get access to the exact html-element, but it's empty.
Turns out that the table exists, but it is empty as long as the user has not pressed a button (labled "load raw data"). I inspected the sourcecode of the webpage. When the user presses the button, a load_table()-function is called which loads the data into the table. Obviously, the URL remains the same, otherwise I could've just used the other URL where the data is already loaded into the table. Has anyone an idea on how to scrape data from a website although it's only on the website if the user presses a button after the website is loaded?
I'm not really a trained Javascript-coder, but I tried to look through the script which is executed after the user presses the button. It's kind of hard to understand for me but I made a pastebin of the script with a highlighting where I think the rows are added to the table if that helps. The code for the button is:
Load raw data
The code I use to access the html element with Jsoup would be (all the child(x) methods are called on different div-elements to go deeper into the html-document until I finally reach the table-element):
Jsoup.connect(url).get().body().children().get(5).child(0).child(4).child(1).child(1);
As I stated above, the element is empty. I hope the description of my problem is detailed enough and somebody has at least an idea of what I'm trying to say. Sorry for my clumsy expressions. Not a native speaker.
if you are familiar with selenim webdriving you could use selenium to load the page and then pass to source page into beautifulSoup argument.
html = pageSource()
you could parse the page by this method i guess
Sorry for the slightly confusing title, but couldn't find anything online to help me with the issue I am facing. Essentially, I have three Javascript files and two different HTML pages. In the first HTML page, let's say first.html, I have two buttons, let's call them Button 1 and Button 2. When the user clicks on Button 1, it opens up a Javascript function in javascript1.js which makes a call to a REST API. It then passes this data to javascript2.js by passing it as a parameter. Essentially, this is how it looks like:
javascript1.js
function firstfunction() {
$.getJSON("http://website.com", function(data) {
newfunction(data);
}
}
Inside javascript2.js is
function newfunction(dataparameter) {
alert(dataparameter);
}
This so far is working perfectly. However, some complications arise with the second button in first.html. Essentially, after the user clicks on the first button a second button becomes available which leads the user to a new html page, in this case second.html. Now inside this HTML page, I want to display the same data that javascript1.js produces in a file called javascript3.js. I have tried many options, such as using cookies, or passing it in a parameter, etc. However, I have been unable to do successfully do it as I am a bit confused on how to include the Javascript files in the HTML page. In first.html, I am including javascript1.js and javascript2.js. In the second.html, should I be including all three javascript files? I could just try to make the get call again in the new HTML page but I'd prefer to find a more efficient way. Please let me know if I should provide more code/explanation; hopefully this question makes sense! Thanks for the help!
I am not great with java script. I have a number of web pages that are all almost identical. As a result I can use the same help page for all. All I want to do is pass the title of the current page to the help page.
The web pages might be called
Fiction eBooks, Non-Fiction eBooks, Classic Fiction eBooks... You get the picture. Every page looks pretty much the same, only the topic and eBook descriptions change.
Rather than create a help page for each type I want to create one help page and pass the type of eBook to it. For example:
The user is on a page titled, "Fiction eBooks" I want to call the help page like this, http://ebookwebsite.com/help.html?Type=Fiction
When the help page loads it will display "Fiction eBooks Help"
All I can find is information for passing form data from one web page to another. This is far more than I need.
You can just send it as part of the url, if you are using a link.
eg: Help
Depending on how you get the title for each, you can even make that link dynamically generated, i.e if you are using jstl or freemarker or handlebars or any such templating/pre rendering you could add the variable for type to prerender.
Can anyone please help me with the following situation?
I've a default.aspx page in which I've 3 user controls.
In one of the user control (say UC1.ascx), I have a gridview which has controls like hyperlink and textboxes. On hyperlink click, I am opening another page in which I've another user control (say UC1.ascx) where some data is fetched from the database and displayed in a gridview. The user will select some of the data and on button save clicked, I am saving the data into a session variable as well as closing the page simultaneously.
My problem is on this button save clicked, I want to update whatever data the user selected to be posted back to the UC1.ascx and bound to the textbox.
I'm not sure how to go about this in javascript. Got suggestion to use ASP.NET Ajax update panel. I'm completely new to ASP.NET Ajax. So somebody please help with the Ajax approach.
The page you close will need to set a value in the original window via javascript assuming the original opened a new window/popup as listed below.
However - have you thought about any other methods, such as ajax requests/update panels on the page to show other dynamic portions of data?
See: http://www.codingforums.com/archive/index.php/t-61319.html
specifially glenngv's post:
function setColor(color){
if (opener && !opener.closed){
opener.document.theForm.theField.value = color;
opener.focus();
}
window.close();
}