Using a link to launch a page with an onclick? - html

I'm not much of a programming person so forgive me if I don't explain this well.
I have a web site with a home page. There are a couple of menus across the top, each with a submenu. When you select one of the submenus, that "page" comes up in the center of the page. So, for example, if I select the menu item biography, the "page_BIO" will load into the main part of the screen. The script looks like this:
Band Bio
It works perfectly . . . all's good in the world when you're on the page.
HOWEVER . .
If I want to have a link to my "biography" from another site or page, it will open http://www.mydomain.com/index#!/page_BIO BUT it won't launch the actual "onclick" script. It basically just loads the index.html page and, from there, you can select what you want.
I'm trying to find a way to launch the index.html page but WITH the BIO page loaded. So, if this makes sense, I want to launch the onclick that resides on one page withe a link from another page.
Does this make sense? Is this possible?
stu

On the index.html, you can read the parameters being passed using the code here: Get escaped URL parameter
If a certain parameter is detected, you can then invoke your JavaScript to load the bio page.
From the referring page, you can then pass the required parameter.
Hope this helps!

Related

How to make a back button that goes to the parent page in C# Razor and 2sxc App?

I have a 2sxc app that is a simple parent-and-child setup. So there's a listing of cards and each card has a details view. I use this app on 6 pages - each with their own unique content. I want to make a "back" link inside of the details view that goes back to that detail's parent.
So one of the pages is called "Motivate", and I want it so if a user goes to "Motivate" and then clicks on one of the details views, let's say "motivate/details/marketer", I want a back link on that details view that goes back to the "Motivate" page. But this link would have to work for each of the 6 categories dynamically. How would I create this in c# razor?
Can you post your code just so that I can see how its all done?
You can the current page id in 2sxc using "#Dnn.Tab.TabID"
If you can get the parent page ID you can use the following link to go to that page
"http://www.example.com/Default.aspx?tabid=TABID"
Regards
Kieran
I was overthinking this. Here's my code:
Go back
This works because when I'm on the details view (a different template), the landing page is still the Tab's Full URL.

wants that when I click on the any index hyperlink, then it is displayed on main description page

I have made an web page. There are two iframes
In it. First is of index and second one is description page. I want that when I click on the any index hyperlink, then it is displayed on main description page.
How it will be possible? please give me the HTML code
You can use a button and when clicking it, change the url of the iFrame using Javascript like this:
document.getElementById('iframe-id').src = newLink;
You can use the data-attribute to store the wanted link in your html.
In case you want to do that: It is not possible to react to things outside of an iFrame through an iFrame. So you cannot put a link in iFrame1 and have it reload iFrame2, because those are two different websites and don't see each other.
Now, idk what exactly you are planing to do, but I really hope, that you don't want to make your entire site like that. Using iFrames is really only useful for things like inserting widgets (like Codepen etc.), but should never be used to display information from your own site. If you don't want to copy your html for every site then use PHP. If you don't want to reload your entire webpage (which is pretty much never a problem) you can use AJAX-requests to load parts of your website. (Frameworks like React.js, Angular.js and Vue.js do that for you)

Why my anchor link from a secoundary page is not working?

I have the following problem with one of my current projects.
I would like to achieve that when you click on a link which is on a secondarly page, it sends you to the home page but, not at the top of the homepage (by default), I would like that it sends you where a specific ID is.
At the moment I have the following URL in this special link but it doesn't work
link
I have tried different ways I saw in this community but I didn't have luck. At the moment when you click it send you to the homepage but at the top and my ID is almost at the end of the page
How can I fix it please?
Thanks
Kindly use below code on page load. make sure you call this once DOM is loaded. This will scroll the page to this anchor.
location.hash = "#contact-anchor";

HTML links not working

I created my first website uploading the first two pages including the first and main page and then a second page that the first page links to. Before doing so, a link that when clicked on, takes me correctly from my main page to a second page worked. After uploading it on 000webhost.com it no longer worked. Meaning, I can view my main page but when I click on the link that should take me to my second page, it doesn't do anything. Here is the code that was and is still included in my main page for the link that should take me to my second page. I have a feeling that it has something to do with the protocol and that I have to make changes to it but not sure what changes to correctly make so the link will work. I used a sub domain at 000webhost.com not my own. Here is the code that was and is on my main page:
<li>Noah's First Day</li>
The link points to a file on your computer (note the file:// prefix). The best practice is usually to have links to your own pages in relative form. So, for example, assuming you uploaded all the files to the same directory, just use the filename itself:
<li>Noah's First Day</li>

squarespace query only for home page

I am using squarespace developer kit and going well. I am wanting to integrate some queries to display some very simple data form my blogs that will appear on my home page ONLY.
Not being very fluent in JSON, I am struggling to implement the query on the home page. I have it set up to display the data from the selected blog but it displays the data through each page.
I only want the data to be visible on the home page at the top. Not in the header but inside where all the content is.
Here is my query that works perfectly well
<squarespace:query collection="feature-articles" limit="10">
<li>
{.repeated section items}
<li>{title}</li>
{.end}
</li>
</squarespace:query>
Can the data be inserted into a code block via the content manager so I can then insert into within the content or am I totally wrong in thinking that.
What I will then do is style/ add or edit the UI of the data into either a carousel or whatever is needed for the project.
I just need to know where to store the query so that it fits in with the content.
Appreciate any time.
Review the following link to see how you can edit a template file, to make different pages use different templates.
http://developers.squarespace.com/template-configuration/
Make a completely custom template just for your homepage then paste you code within your custom .region file as outlin ed in the above guide.
Here is the page about working with template pages:
http://developers.squarespace.com/layouts-regions/
Seeing as you know about , I have a feeling you might already know this, so you might want to be a bit more specific about how your displaying your code and I will gladly update my answer.