I have no clue why this is happening. When I load a certain page on my site, my content loads twice. Basically, my content appears to flash once.

I can't figure out what's going on, but it seems to deal with the following code. The page calls urlCheck().

// display correct content
function chooseContent(num) {
	highlightButtons(num);
	obj = document.getElementById('portSample' + num);
	obj.style.display = 'block';
}

// highlight the correct buttons relating to content.
function highlightButtons(num) {	
		obj = eval('document.port' + num);
		obj.src = portThumbActive[num-1];
		obj.name = ('active');
		
		obj = eval('document.nav' + num);
		obj.src = navActive[num-1];
		obj.name = ('active');
}
function urlCheck() {
	// store url in a string
	url = window.location.href;
	
	// check url for #1, #2 etc
	for (var c=1; c<= portThumb.length; c++) {
		hashNum = url.search('#' + c);
		if (hashNum != -1) {
			obj =  document.getElementById('port' + c);
			strName = obj.name;
			
			// if correct content is already displayed, don't reload it.
			if (strName.search('active') == -1) {
				chooseContent(c);
			}
		}
	}
}

Let me know if you want more info. If a link to the page would be useful let me know.

Recommended Answers

All 6 Replies

the url of the page would be helpful

Okay. Here is the url: http://alicepiccola.com/testSite/index.html

When I click from my homepage to the portfolio page is when it loads the content twice. Let me know if you need more info. I still have no clue what's happening! I've googled everything I could think of...

I forgot to mention that I haven't started testing my site in other browsers yet. I've been working in FF.

When I click from my homepage to the portfolio page is when it loads the content twice. Let me know if you need more info. I still have no clue what's happening! I've googled everything I could think of...

Hard to say why it does that double load thing. I see it in IE too so it's not just FF.

I would suspect hypehenator. Try commenting out the line Hyphenator.run(); and see if it still misbehaves.

Airshow

There's some javascript error when you click the portfolio link.
Stick this on your page, it might help:

function globalError() {
            var foo="\r\n" + arguments[0] + " in " + arguments[1] + " at line " + arguments[2];      
			alert(foo);
        }
        window.onerror = globalError;

Thank you guys! It seems to be the hyphenator script. I don't even need that script for the portfolio page, so it's not a problem to relocate the function call.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.