Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Geek Culture / Some semi complex HTML help needed

Author
Message
AlecM
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Concord, MA
Posted: 30th Sep 2002 04:35
I working on a page that uses a a table as a scrolling text box. what i would like to be able to do is click links at the top of the page and have different content load into the window (without the whole page reloading)

here is my code:




Description
Terrascape is a new application from ShellShocked entertainment. Terrascape is designed to be used by game developers for generating high quality heightmaps quickly and efficiently. Terrascape features six unique algorithms with full control over terrain generation.

Features:

-Exports to bitmap and .x

-Six algorithms

-Control over:
Size
Seed Value
Minimum and maximum height
Passes
Contrast
And other parameters


-Realtime 3D viewing (Rotating view and flythrough)

-Height-based texturing options

-Full suite of image editing tools for carving canyons and raising mountains












Price:
$5 USD



Goto http://www.shellshockede.com
Rob K
Retired Moderator
21
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 30th Sep 2002 20:09
Use the document.[span_or_div_name].innerHTML commands in javascript.

Basically you set up the code like this:

<span id=change
THIS IS THE DEFAULT TEXT OR HTML
</span>

Then have a Javascript function:

changecode(link){
if (link == 'first'){
document.['change'].innerHTML = '<b>REPLACEMENT CODE</b>';
}
}

Then the link:

<a href="javascript:changecode('first')">Click to change the code</a>

I might have left something out. I'll try and write a quick demo and give you the URL then you can copy the source code.

The code to replace the default code with can be loaded in from a text or html file.

Alternatively there is an iFrame element and I think the URL for this can be controlled with JavaScript. I will research a bit more then check back.

Hope this helps!

what is a signature?
AlecM
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Concord, MA
Posted: 1st Oct 2002 04:20
wow, thanks

Goto http://www.shellshockede.com
Richard Davey
Retired Moderator
21
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 1st Oct 2002 04:43
Frogger - on the darkbasic.com site on the "About" page there is code to do just this too (scroll down until you find the small bit of example DB code).

Cheers,

Rich

"Gentlemen, we are about to short-circuit the Universe!"
DB Team / Atari ST / DarkForge / Retro Gaming
David T
Retired Moderator
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 6th Oct 2002 15:31
DreamWeaver 4 can use layers and set their text - let me know if you want it doing, I have DW4 and would be glad to help.

I love Star Trek.
Especially the Episodes with Starships in.
David T
Retired Moderator
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 6th Oct 2002 15:38


Maye need a bit of butchering, but it does the basic feature you required.

I love Star Trek.
Especially the Episodes with Starships in.
AlecM
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Concord, MA
Posted: 6th Oct 2002 18:43
david, i will email you the page when i get home in a few hours. oh, whats your email?

Goto http://www.shellshockede.com
David T
Retired Moderator
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 6th Oct 2002 20:52
Well, I'm not a JavaScript guru, that's just what I rustled up in DW4. I think thundermonkey's code is the best as it allows for HTML to be put in aswell. Anyway, when the RGT forums get back up I will PM you my email, I don't like to give it away in public.

I love Star Trek.
Especially the Episodes with Starships in.
Rob K
Retired Moderator
21
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 7th Oct 2002 01:01
FroggerMon, here is a working example script, the one I listed above doesn't work (my mistake)

Just copy this code into an HTML file.

<html>
<span id="change">
This is some text
</span>
<br><br>
<a href="javascript:changecode()">Click Here to change the text</a>
<script language="javascript">

var newHTML
newHTML = '<b>This is some different text</b>'


function changecode()
{
document.all['change'].innerHTML = newHTML;
}

</script>
</html>


what is a signature?
Rob K
Retired Moderator
21
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 7th Oct 2002 01:10
The easiest way to do it is to have a seperate function for each link.

eg:

infolink()
screenlink()

etc.

This code works and is better than DreamWeaver's because you can actually understand it. Unfortuantely DreamWeaver also produces very long-winded code, not your fault David, DW is just unavoidably like that.

The classic example is rollover images, what I did in 12 lines, DreamWeaver did in 44 with lots of confusing 12 digit numbers (aaaggghh!) - GoLive was even worse: 112 lines of utter rubbish to achieve such a simple effect.

If the new HTML code inside needs to contain URLs etc, they must be in standard quotes "", not '', because that denotes the start and end of the string. I suggest you produce the HTML then cut and paste it into the newHTML value (you can define more variables as needed)

Let me know if you have any problems.

One more thing - there is also an innerText command which can be used instead of innerHTML, it does the same thing but any HTML is just printed as text rather than being used normally.

Hope this helps.

what is a signature?

Login to post a reply

Server time is: 2024-03-29 15:19:05
Your offset time is: 2024-03-29 15:19:05