passing a textbox value as the query string parameter - javascript

am looking forward for a solution to the following problem
i do have one i frame in my web page which refers to the content of yet another page.My problem is that i need change the content of the i frame upon the text box value. so i decided to pass the value of my text box as query string parameter
like
src="E/Ess/Application_form1.aspx?USER=document .getElementById(TXTCODE).value ">
with in my I frame.
but it seems it doesn't work any more.. i have tried java script function also ?expecting a reasonable solution

Related

is there a way to change elements of a page before opening it

I have designed a page to be used as a tool. I am getting some challenges here since my experience is very little in the field and im only new.
- my goal is to change values of an element on a page that is not open yet.
- is there a function i can make on current page to change the values of the element on the next page to preset it to some static numbers or some of them are dynamic
I dont know how to manipulate something that is not open yet, i dont even know if that's something possible. I was able to change elements on my open current page, but dont know how to change something on the next page if i click on one of the links
Park Property Management
Millgate Manor
Weston Towers
Kingston
Region Of Peel
so i expect to click on one of the links and when the link opens some elements in the links i need them to be filled with some values that are static always
You can't directly influence the content of another page with JavaScript in the current page. That would have very big security concerns.
However, you could indirectly influence the content if you have access to the source for both pages, and can add JavaScript to both of them. Then, as some comments suggested, you can for example use search paramaters in the link url to pass along information.
(Search parameters are the stuff that comes at the end of a url sometimes and looks something like ?name=john&id=555)
You can read more about about working with search parameters in JavaScript here:
https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams
Don't get discouraged! You're capabilities will grow as you try to make things work. (That's almost the only time they will grow.)
A word of caution!
Please be very careful when using search parameters to modify or display content on a page as there are some real security concerns involved. Never display anything from the search parameters directly on the page without validating the input first. A good way to handle dynamic content based on search parameters, at least if you know the possible options available, is to have some if .. else statements or maybe a switch block that you try to match the search parameters against, and simply not display anything at all if the content of the parameter does not match any input that you're expecting.

How can I find the actual link which is related to the javascript

I'm a student stuyding the bioinformatics.
I'm trying to make a crawler where I can put the lists of queries and get the results automatically.
The site I'm interested in is the GEO DataSet site.
www.ncbi.nlm.nih.gov/gds/
If I wish to send a query like 'lung cancer', I can use the following address.
http://www.ncbi.nlm.nih.gov/gds/?term=lung+cancer.
And there are 549 pages showing up.
I can get the results of the first page, but I don't know how to move to the next page.
I mean, how can I move to the next page by changing the URL?
The Next button is linked as "www.ncbi.nlm.nih.gov/gds/?term=lung+cancer#" and I don't think it's the actual URL that button is linked to.
I'm new to the JavaScript, but I heard the hash sign (#) is processed in the JavaScript
I wonder if there is something I can do like
"http://www.ncbi.nlm.nih.gov/gds/?term=lung+cancer&page=2"
so that I can move to the second page.
If you use any debugger tool (Firebug for Firefox, WebDeveloper for Chrome) you should be able to monitor the network traffic. If you do that, you'll see, that by clicking the next button a form is submitted, sending data via post method. However, when concatenating the post data to a get string you can also get to the next page. The following url lets you access to second page of the result set (warning: really, really long!):
http://www.ncbi.nlm.nih.gov/gds/?term=lung+cancer?term=lung+cancer&EntrezSystem2.PEntrez.Gds.Entrez_PageController.PreviousPageName=results&EntrezSystem2.PEntrez.Gds.Gds_ResultsPanel.Gds_DisplayBar.sPresentation=docsum&EntrezSystem2.PEntrez.Gds.Gds_ResultsPanel.Gds_DisplayBar.sPageSize=20&EntrezSystem2.PEntrez.Gds.Gds_ResultsPanel.Gds_DisplayBar.sSort=none&EntrezSystem2.PEntrez.Gds.Gds_ResultsPanel.Gds_DisplayBar.FFormat=docsum&EntrezSystem2.PEntrez.Gds.Gds_ResultsPanel.Gds_DisplayBar.FSort=&EntrezSystem2.PEntrez.Gds.Gds_ResultsPanel.Gds_DisplayBar.FileFormat=docsum&EntrezSystem2.PEntrez.Gds.Gds_ResultsPanel.Gds_DisplayBar.LastPresentation=docsum&EntrezSystem2.PEntrez.Gds.Gds_ResultsPanel.Gds_DisplayBar.Presentation=docsum&EntrezSystem2.PEntrez.Gds.Gds_ResultsPanel.Gds_DisplayBar.PageSize=20&EntrezSystem2.PEntrez.Gds.Gds_ResultsPanel.Gds_DisplayBar.LastPageSize=20&EntrezSystem2.PEntrez.Gds.Gds_ResultsPanel.Gds_DisplayBar.Sort=&EntrezSystem2.PEntrez.Gds.Gds_ResultsPanel.Gds_DisplayBar.LastSort=&EntrezSystem2.PEntrez.Gds.Gds_ResultsPanel.Gds_DisplayBar.FileSort=&EntrezSystem2.PEntrez.Gds.Gds_ResultsPanel.Gds_DisplayBar.Format=&EntrezSystem2.PEntrez.Gds.Gds_ResultsPanel.Gds_DisplayBar.LastFormat=&EntrezSystem2.PEntrez.Gds.Gds_ResultsPanel.Entrez_Pager.cPage=1&EntrezSystem2.PEntrez.Gds.Gds_ResultsPanel.Entrez_Pager.CurrPage=2&EntrezSystem2.PEntrez.Gds.Gds_ResultsPanel.Gds_ResultsController.ResultCount=10973&EntrezSystem2.PEntrez.Gds.Gds_ResultsPanel.Gds_ResultsController.RunLastQuery=&EntrezSystem2.PEntrez.Gds.Gds_ResultsPanel.Entrez_Pager.cPage=1&EntrezSystem2.PEntrez.Gds.Gds_ResultsPanel.Gds_DisplayBar.sPresentation2=docsum&EntrezSystem2.PEntrez.Gds.Gds_ResultsPanel.Gds_DisplayBar.sPageSize2=20&EntrezSystem2.PEntrez.Gds.Gds_ResultsPanel.Gds_DisplayBar.sSort2=none&EntrezSystem2.PEntrez.Gds.Gds_ResultsPanel.Gds_DisplayBar.FFormat2=docsum&EntrezSystem2.PEntrez.Gds.Gds_ResultsPanel.Gds_DisplayBar.FSort2=&EntrezSystem2.PEntrez.Gds.Gds_ResultsPanel.Entrez_Filters.CurrFilter=all&EntrezSystem2.PEntrez.Gds.Gds_ResultsPanel.Entrez_Filters.LastFilter=all&EntrezSystem2.PEntrez.Gds.Gds_ResultsPanel.Gds_MultiItemSupl.Taxport.TxView=list&EntrezSystem2.PEntrez.Gds.Gds_ResultsPanel.Gds_MultiItemSupl.Taxport.TxListSize=5&EntrezSystem2.PEntrez.Gds.Gds_ResultsPanel.Gds_MultiItemSupl.RelatedDataLinks.rdDatabase=rddbto&EntrezSystem2.PEntrez.Gds.Gds_ResultsPanel.Gds_MultiItemSupl.RelatedDataLinks.DbName=gds&EntrezSystem2.PEntrez.Gds.Gds_ResultsPanel.Discovery_SearchDetails.SearchDetailsTerm=%22lung+neoplasms%22%5BMeSH+Terms%5D+OR+lung+cancer%5BAll+Fields%5D&EntrezSystem2.PEntrez.Gds.Gds_ResultsPanel.HistoryDisplay.Cmd=PageChanged&EntrezSystem2.PEntrez.DbConnector.Db=gds&EntrezSystem2.PEntrez.DbConnector.LastDb=gds&EntrezSystem2.PEntrez.DbConnector.Term=lung+cancer&EntrezSystem2.PEntrez.DbConnector.LastTabCmd=&EntrezSystem2.PEntrez.DbConnector.LastQueryKey=1&EntrezSystem2.PEntrez.DbConnector.IdsFromResult=&EntrezSystem2.PEntrez.DbConnector.LastIdsFromResult=&EntrezSystem2.PEntrez.DbConnector.LinkName=&EntrezSystem2.PEntrez.DbConnector.LinkReadableName=&EntrezSystem2.PEntrez.DbConnector.LinkSrcDb=&EntrezSystem2.PEntrez.DbConnector.Cmd=PageChanged&EntrezSystem2.PEntrez.DbConnector.TabCmd=&EntrezSystem2.PEntrez.DbConnector.QueryKey=&p%24a=EntrezSystem2.PEntrez.Gds.Gds_ResultsPanel.Entrez_Pager.Page&p%24l=EntrezSystem2&p%24st=gds
This complete GET string contains all search parameters like items per page, search terms, display and way more. You should be able to figure out which parameter is used for the offset (cPage and CurrPage are your friends) and then alter it to your needs.
EDIT: Btw, to find javascript events bound to an HTML element, you can use the bookmarklet found at http://www.sprymedia.co.uk/article/Visual+Event+2

Simple code to bring up multiple iFrames on one page?

It's been a while since I last did coding, I was just wondering how simple I could make this little idea of mine.
Simply put, I'd like to have 4 input text fields on one page, an example of the label and text field is: http://www.url.com/[ASpecificLink] where the [] denotes Text Fields. Upon filling all the text fields and clicking 'Okay', the next page will list iFrames of the link specified, making it a total of 4 iFrames on one page.
My first question is : How simple could I make this idea? off the bat I thought of using PHP, ideally i'd like to access this on an iPad.
My second question is : Would it be possible, for example, to list specific content in the iFrames. For example, in the link I enter, the only content I would like to show is what is contained within the Table elements of the whole page (this would mean the top banner, navbar and other elements would be excluded)
Thank you very much, and looking forward to some other perspectives on this idea. My approach might not be the most efficient way to go about this, and therefore I'd appreciate some out-of-the-box opinions.
Thank you very much
As for the first question : it is very simple to do, but you should'nt use PHP. This can be done very easily with Javascript :
Create a new IFrame element
Set the "src" property to the content of the text inputs
Append it to the page
The browser will load the pages in the iframes by itself.
As for the second question :
Load the page using AJAX (Javascript)
Get the elements you want from the page with Javascript
Append them to an IFrame's ContentWindow property
No code here, since you seem to be only expecting ideas of implementation options :-)

Bookmarklet to pass URL to form field

I want to create a bookmarklet that will allow users to submit URLS from sites on the fly as they browse.
I'm looking for three possible implementations of this bookmarklet.
Simply click the bookmarklet and be taken to the page with my form field and have the URL they just came from entered into the field.
Simply click the bookmarklet and be taken to the page with my form field and the link they had highlighted from the previous page is entered into the field.
The preferred option - Click the bookmarklet, a popup (similar to Twitter's tweet box in size and function) opens with my form field pre-populated with the URL of the page they clicked the bookmarklet on. Like Twitter's tweet box and facebook's share box.
I typically don't just give away code, but this is so simple I figure it's worth sharing and explaining.
Compressed:
javascript:(function(f,s,n,o){window.open(f+encodeURICompnent(s),n,o)}('http://example.com?url=',window.location,'yourform','width=300,height=200'));
Expanded
(function (formurl, site, name, options) {
window.open(
formurl+encodeURIComponent(site),
name,
options
);
}('http://example.com?url=', window.location, 'yourform', 'width=300,height=200'));
The way this works is it just calls an anonymous closure to pass variables to the window.open function. It passes the current page's location as the uri value in the query string.
On the page containing your form, you'll need to populate the correct field with the value from the query string.
Although this could be written without using a closure, you need to make sure that there isn't a return value from whatever's being called, as javascript:<string value> will re-write the DOM with whatever text was in <string value>.

Javascript for two iframe connection

i have a query
thr is one web page
and i am using two iframe in that
like equal partision of a page
and there are some contents , words , text which are same in both parts
and if i am selecting any one word or sentence which are also in second part will be highlight
I don't think there is a way to select web page content via JS. You might be able to do this if it were just text in a textbox or something similar.
UPDATE
As is usually the case, I was proven wrong :) Check out Marcel's posted function. This function appears to select content between two object. You'll just need to do this twice (one for each frame object), rather than once using the document object
selecting text by ignoring inner Elements of div tag javascript

Categories

Resources