How to call div content in widows.open() - javascript

Actually i have a asp:LinkButton in aspx page and i just want that whenever user clicks on asp:LinkButton open popup on dat asp:LinkButton its already done and i have given another link to it(its ur website's link only) and its working fine,
but the problem is now i want to open a popup with checkboxes with the cities name.
i have made one type of you can say block in a DIV on the same aspx page in the bottom and now i want is to call this div content in the script above in windows.open..
Please help me out ..
asap
Thank You!

You can't show only piece of the current page using the window.open function - only the whole page.
Use ModulPopup from the AjaxControlToolkit or Dialog from the jQuery-UI or some similar functionality.
Or you can create new page that will contain only div with cities names checkboxes and open it via the window.open function

Related

Click a link and stay on the same page

I am trying to navigate to another HTML file without changing pages. Basically I got an emergency button, and once clicked, it should open an HTML file which pops up a box displaying 3 other buttons. This box also has an "X" to close the window, to close this HTML file and go back to the other.
Basically I want 2 html files to display at the same time. I am currently using adobe edge animate to do the process, however I am capable to use Javascript and HTML.
To give you an idea: It is similar to when visiting a website and a box pops up asking you if you want to subscribe to the news letter, or just keep searching.
Thanks
Well. what i understand of your question. You want an html page on an html page. I suggest you could use JQuery popup screen. Visit this link. https://jqueryui.com/dialog/
If you want to call another html page without refreshing your page use Jquery .load(). http://api.jquery.com/load/
$( "#div_to_load_file_in" ).load( "path/to/your/file.html" );

After clicking a link, open new URL and automatically *click* on tab link inside that page

Is it possible to implement this behavior:
I have a HTML link on one page, and after a user clicks on it, it goes to another page which has several tabs on it. Upon clicking on one of those tabs, it triggers an AJAX post call which populates and displays content for that tab.
I would like that when a user clicks a link on the previous page, it takes him to another page and automatically clicks a specific tab so it triggers an ajax call which displays the content for that tab.
This site is a Wordpress site, if that information helps at all.
On the 'from' page you can have links such as
Click Me
You can set an onpage load function to load and use a trigger like this
if(window.location.hash === "#customHash"){
//my custom tab loader
}
You can use jQuery Cookie plugin to achieve this. http://plugins.jquery.com/cookie/
You just set the cookie on the first page, when the user clicks on the link
$.cookie('the_cookie', 'the_value');
And on the next page use the jQuery on load function to check for the cookie.

how to reload an aspx page within an iframe when click event triggers from the control within an iframe

I have a webpage wherein I have an iframe and I am loading a separate webpage [aspx] say wb2.aspx within it. There is a button named add comment in wb2.aspx. When the button is clicked a modal pop up will appear and it accepts some values and stores it in database. I am displaying the comments in wb2.aspx. Now my intention is soon after the comment is added the page must be refreshed and the newly entered comment must be visible. How can I do this?
After a long search I got this answer..
string script = "this.window.parent.location=this.window.parent.location;this.window.close();";
if (!ClientScript.IsClientScriptBlockRegistered("REFRESH_PARENT"))
ClientScript.RegisterClientScriptBlock(typeof(string), "REFRESH_PARENT", script, true);

How to link to a "tab" on my website

I have made tabs on my site. By tabs I mean the navigation links, rather then loading a new page use some java script and css to just switch to another tab containing more content. I'm wondering how I would be able to link to a specific page when it's done like this?
My code is similar to this one:
Using jquery easyui, how to create a tab by a link which is in a tab?
Edit: http://fogest.net16.net/righttoweb/ <<< There is a link to the site. Look at the tabs. How would I link to the page of one of those tabs?
Add anchors to the end of your URL, ie http://URL/righttoweb#about and on $(document).ready() block of code pick up the anchor and using a hash table figure out what tab needs to be selected.
Also make sure when users click on your tabs, you update the anchor in the top bar as well, in order to preserve which tab was selected if the user decides to bookmark the URL or send it to someone else
edit:
Well every time a user clicks on one of your tabs, with the onClick event you need to alter the navigation history of your page, for ex:
window.history.pushState("object or string", "Some Title", "#tab" + tabname);
This will enable the back/forward buttons to work
then everytime the page loads you need to
$(document).ready(function() {
if(window.location.href.indexOf('#'))
updateTab(location.hash);
});
function updateTab(tabname) {
your logic to update tab...
}
Hope this makes sense

Open redirect page in new tab and reopen in the same tab on multiple redirects Django

I am making a blog app in Django and I want to do the following things
When the user submits the preview button I want to open the partially completed blog in a new tab in the same window.
Secondly if the user does not close the tab and again presses preview button, I want to display the updated blog in the tab which was previously opened.
How can I do this?
Edit:
As told in the answer below I am trying to use this code snippet to open it in a new window, but this does not work
<script>
var current_link = $(location).attr('href');
$('.preview_button').onClick(function() {
window.open(current_link,'preview_tab');
});
</script>
Also I currently have 3 submit buttons and I want to provide this feature only for 1 submit button i.e. preview So I cannot directly do (#form).onSubmit. For the the other two buttons, one updates the content via Ajax and the other redirects to a new page.
Try using a Javascript onSubmit to open the appropriate preview page with window.open, passing a name as the second parameter. It does almost exactly that. (If you want to support having different preview tabs associated with different editing tabs, include something in the name based on a tab ID of some kind -- maybe the article ID plus a random number, or something.)
You'll have to also send the updated content into the server via AJAX.

Categories