Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-03-2012, 07:58 AM   PM User | #1
natashajne
New to the CF scene

 
Join Date: Dec 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
natashajne is an unknown quantity at this point
plz plz help.....

i have created a page n am loading two pages on a div container with a button click using javascript. that i did, but my problem is when i click a button, i want the page to get loaded as well as to go to a specific position in that page. i have given [code] <a name>[code] to the ordered list n calling the link via a href. but javascript is calling first so the page gets loading n after that i have to click the link again for the page to show thwe correct location. both [code]<a name> [code]and javascript to load function is working but its not working simultaneously.

my code:
Code:
            <div class=part>
      
            <div class="part1">
       
         
        
           <div class="span-19 last" id="response">

		</div>
           
           
           
            </div><!--part1-->
            
            <div class="part2">
            
            <div class="textwidget"><div id="call-button1"><a href="#">Get Started</a></div></div>
            
            <div class="back1">
            
           <div id="sidehed">Organized by Industry</div>
           
             <ul id="testContainer">
             
            <li class="plant"><a href="#plant">Plants and Refineries</a></li>
            
            <li class="transmittt"><a href="#transmit">Transmission Lines</a></li>
            
            <li><a href="#marine">Marine and Offshore</a></li>
            
            <li><a href="#repair">More Repairs</a></li>
            
           
            </ul>
            
            <div id="sidehed">Organized by Repair Type</div>
            
            <ul id="industries">
            <li><a href="#corrosion">Corrosion Prevention</a></li>
            <li><a href="#structure">Structural Repair</a></li>
            <li><a href="#leak">Leak Repair</a></li>
            
           
            
            
            
            
            </ul>
            
            </div>
            </div>
            
            
            
            
            
            
            
            </div><!-- part -->
am loading two pages i.e repair type pge n industry page in [code]<div class="span-19 last" id="response">

</div>
[code] this div . i wanted to load poage 1 n pag3e 2 in this div as well as when i click on corrosion prevention it has to load that page in the div as well as go to that position of that page. am loading the page using javascript.
Code:
javascript:

$(document).ready(function(){
	// load index page when the page loads
	
	 	$("#response").load ("page1");
	 	
	$("#testContainer").click(function(){
	// load home page on click
		$("#response").load ("page1");
			
        
	});
	
	$("#industries").click(function(){
	// load about page on click
		$("#response").load ("page2");
	});
	
	 
});
plz help

Last edited by VIPStephan; 12-03-2012 at 12:39 PM.. Reason: fixed code BB tags
natashajne is offline   Reply With Quote
Old 12-03-2012, 12:14 PM   PM User | #2
devnull69
Senior Coder

 
Join Date: Dec 2010
Posts: 2,261
Thanks: 10
Thanked 533 Times in 527 Posts
devnull69 will become famous soon enough
please reformat your code

- The closing tag for [ code ] is [ /code ]. This can also fix your indentation issues ...
- The inline code tag is [ icode ]
- The English language sometimes makes use of uppercase characters ... which sometimes make a big difference (for example if you want to help your Uncle Jack off a horse)
devnull69 is offline   Reply With Quote
Old 12-03-2012, 01:44 PM   PM User | #3
DanInMa
Senior Coder

 
DanInMa's Avatar
 
Join Date: Nov 2010
Location: Salem,Ma
Posts: 1,335
Thanks: 13
Thanked 207 Times in 207 Posts
DanInMa is on a distinguished road
try load.("page1.htm") you need to include the full file name.
__________________
- Firebug is a web developers best friend! - Learn it, Love it, use it!
- Validate your code! - JQ/JS troubleshooting
- Using jQuery with Other Libraries - Jslint for Jquery/other JS library users
DanInMa is offline   Reply With Quote
Old 12-04-2012, 06:31 AM   PM User | #4
natashajne
New to the CF scene

 
Join Date: Dec 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
natashajne is an unknown quantity at this point
I have given correct url for page1, Here i just written page 1 instead of the full url, actually my code n url is working fine but its not taking me to the correct position at the time of loading the page, i.e javascript is working first n then <a name> tag. i want both to work simultaneosly. so that i dont have to double click the link. just click on the link so it 'll load the page in the div container as well as take me to the correct position of the heading in the page. can anyone plz help...
natashajne is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:25 AM.


Advertisement
Log in to turn off these ads.