Click here to Skip to main content
15,887,676 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
hi guys
i have made a game with java script and jquery, in other side i have built a web page with css and html.i have a site and now i want to create a link in my site so direct to my new web page by clicking on.in the web page, i want to run the game mentioned above.but i can not do them.give me some solution.
thanks in advance
Posted
Comments
Sergey Alexandrovich Kryukov 30-Oct-14 15:15pm    
Anchor..?
—SA
Zebtec 31-Oct-14 5:54am    
you get top answering score by writing an irrelevant comment...
Sergey Alexandrovich Kryukov 31-Oct-14 11:12am    
Baseless and rude. It's impossible get any high score with just comments; and I don't care about the score. The reputation, however, comes from member's feedback.
For example, after your aggressive comments some members will make some opinion on you.
Now, please tell me why an anchor cannot be used to point to your site? There are ways, of course, Ajax, etc...
—SA
Zebtec 31-Oct-14 12:58pm    
you don't ask your question brightly.if i don't be able to recognize your question how can i answer you???i can write with html and css and jquery and java script.according to what i said above, there is a problem in using page and game made by them.how can i run a game on web so it cash on server, i mean it run without any downloading.
excuse me because of my challenge and thanks for your answer in advance :)
Sergey Alexandrovich Kryukov 31-Oct-14 13:16pm    
Okay. Anchor is something which is already answered, as Solution 1. Other way would be some JavaScript calls. You can redirect the current page or create an new page and show your site there (however, pop-up blockers might block it). So you can call such JavaScript methods from, say, some control event.
CSS3 even allows to control the tabs, say, load a resource in new page, preferring it to be the new tab.
You can easily find it all by the search like "JavaScript window", "JavaScript redirect", "jQuery load". Do you need help with that?
—SA

Try:
HTML
<a href="http://www.YourDomain.com/folder/WebPageWithYourGame.aspx">Your text for the user to read and click on</a>
 
Share this answer
 
Comments
Zebtec 31-Oct-14 5:52am    
thanks, but there is a problem yet.when my page gets started how can i explain to that page to run game??
Sergey Alexandrovich Kryukov 31-Oct-14 13:35pm    
5ed.
—SA
Solution 1 already provides the most basic yet practical way of linking to your site: HTML anchor.

Other ways can be implemented by JavaScript. Those ways can only be needed if you want to load your site's page on some other event rather then the anchor click (some button clicks, modifying some state of some controls, successful calculation of anything, authentication — you name it).

First of all, you can simply redirect to your page:
JavaScript
window.location = "http://www.YourSite.org";
// or
window.navigate("http://www.SomeSite.org");


The object window reference the window object know in the context of any script on a page, the window of a current page. So, you can obtain an instance of some other window and load your resource there:
http://www.w3schools.com/jsref/obj_window.asp[^],
http://www.w3schools.com/jsref/met_win_open.asp[^].

Pay attention for the open method; it will return an instance for you. However, as this way you create a new window, pop-up blockers (a popular kind of browser plug-ins) can block it. With CSS3, you can even control the tab feature of modern browser and create a new tab. However, not all browsers implement this feature: http://www.w3schools.com/cssref/css3_pr_target-new.asp[^].

Besides, you can load the page and put its content to any HTML element. The most convenient way to do so would be using jQuery: http://api.jquery.com/load[^].

If you need to learn jQuery (highly recommended), please see:
http://en.wikipedia.org/wiki/JQuery[^],
http://jquery.com[^],
http://learn.jquery.com[^],
http://learn.jquery.com/using-jquery-core[^],
http://learn.jquery.com/about-jquery/how-jquery-works[^] (start from here).

Remember that jQuery is designed with compatibility in mind.

—SA
 
Share this answer
 
Comments
Maciej Los 31-Oct-14 17:34pm    
Patience, patience and one more time patience. How many times we lose our patience because of silly thing.
Nice answer, +5!
Sergey Alexandrovich Kryukov 31-Oct-14 19:12pm    
Well, that said, patience is a winner, so it worth it. :-)
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900