Twokinds ARCHIVE Forums

This forum is for the preservation of old threads from before the forum pruning.
It is currently Mon May 12, 2025 12:26 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 14 posts ] 
Author Message
 Post subject: <A> n' Java
PostPosted: Mon Nov 28, 2005 9:38 am 
Offline
Merchant
User avatar

Joined: Sun Jun 26, 2005 4:44 pm
Posts: 187
Location: Why do you care?
OK, this is simple. I want to define a Variable with a <A> link, but I can't find any info or, what I can find, is bundled up in massive coding which makes it hard for me to get.

That's all, just use "Var" for the Variable if you post an example. Thank you.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 29, 2005 9:35 pm 
Offline
Master
User avatar

Joined: Sun Aug 28, 2005 12:42 am
Posts: 271
Bleh.. ummm. I believe you can use a command called "javascript:void(0)" to have it active a javascript script. And in that script have it define the varible.. I don't really know the programin' to it though >.>;;;;


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 29, 2005 11:01 pm 
Offline
Grand Templar
User avatar

Joined: Sat Oct 22, 2005 7:18 am
Posts: 1310
Location: Singapore
i hate javascript, it always means something wont show on the browser.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 29, 2005 11:58 pm 
Offline
Templar Inner Circle
User avatar

Joined: Wed Mar 09, 2005 1:55 am
Posts: 2885
Location: Somewhere in my pants.
I don't think we're talking about Javascript here. Also, if you could explain what you're doing and what exactly you mean, that would help. I am pretty fluent in Java, so with that ifo I can probably help you with you're problem.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 30, 2005 12:19 am 
Offline
Grand Templar
User avatar

Joined: Sat Oct 22, 2005 7:18 am
Posts: 1310
Location: Singapore
just going a incy wincy little bit off topic here.

what is that in your avatar kangaroo? a screaming chibi drawing?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 30, 2005 8:29 am 
Offline
Merchant
User avatar

Joined: Sun Jun 26, 2005 4:44 pm
Posts: 187
Location: Why do you care?
I'll show you some but just enough
Code:
<Head>
<Script>
Var0=0;
</Script>
</Head>
<Body>
<A -insert code here-><img src="img.extension"></A>
<Script>
if (Var1=0){Var0=1};
if (Var1=1){Var0=0};
If (Var0=1){document.write('text')};
</Script>
</Body>


Where -insert code here- is I need to make it so that it will set Var1 to Var0 when you click it. Thing is, I just can't figure out how to do that.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 30, 2005 5:18 pm 
Offline
Templar Inner Circle
User avatar

Joined: Wed Mar 09, 2005 1:55 am
Posts: 2885
Location: Somewhere in my pants.
Oh, That's easy, just use a function.
Code:
<html>
<head>
<script type-"text/javascript">
var0 = 0;
var1 = 1;
function switchy () {
  var1 = var0;
}
</script>
<title>It be a title</title>
</head>
<body>
<a href="javascript:switchy();"><img src="img.extension"></a>
</body>
</html>
Quite simple actually. ;P

By the way, on a side note, What you're using here is javascript, something entirely different than Java. Where javascript is a browser based scripting language, Java is a full powered programming language. Just thought I'd throw that in. ;D


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 30, 2005 8:10 pm 
Offline
Grand Templar
User avatar

Joined: Sat Oct 22, 2005 7:18 am
Posts: 1310
Location: Singapore
ahhh, i'm not thought the arts of advanced script writing, brain overload!!!

*head explodes*


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 30, 2005 10:24 pm 
Offline
Resident Rule Nazi
User avatar

Joined: Tue Feb 15, 2005 3:52 pm
Posts: 1122
I will be taking programming next year after I graduate from my current class. If my stay in these forums last that long, I will post what I learn here, should I find any of the material useful.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 30, 2005 11:14 pm 
Offline
Templar Inner Circle
User avatar

Joined: Wed Mar 09, 2005 1:55 am
Posts: 2885
Location: Somewhere in my pants.
TEMJIN-2X35O wrote:
ahhh, i'm not thought the arts of advanced script writing, brain overload!!!

*head explodes*
It's really not advanced at all, in fact any useful script uses functions. They are an essential part of most any programming language, and are often reffered to as methods. Usually in javascript a function is created like this:
Code:
function function-name (function-arguments) {
   //commands to be exectued when the function runs
}
A good example of this would be:
Code:
c = 0;
function add (a, b) {
   c = a + b;
}
This would be called in javascript like so:
Code:
add(1, 3);
and 'c' would now equal 4. Of course, you could replace 1 and 3 with any numbers to be added by the function. In HTML, you would call the function like this:
Code:
<a href="javascript:add(1,3);">Call the function!</a>
Again, you can replace 1 and 3 with any numbers to be added.Hope you found that helpful. ;D

By the way, if anyone notices anything wrong with this feel free to let me know, I haven't worked with javascript in a while.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 30, 2005 11:39 pm 
Offline
Grand Templar
User avatar

Joined: Sat Oct 22, 2005 7:18 am
Posts: 1310
Location: Singapore
wow, but you can use it as a weapon against me, since i'm prone to overloading on some cases, my mainframe computer in my head cant take it.

... ...

just dont let s.irver know... you know that little competition between us.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 01, 2005 6:28 am 
Offline
Grand Templar
User avatar

Joined: Fri Aug 26, 2005 10:20 am
Posts: 1436
Location: UK, Derbyshire
yes javascrpit is a evil thing.

i try to avoid it at all times.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 01, 2005 8:41 am 
Offline
Merchant
User avatar

Joined: Sun Jun 26, 2005 4:44 pm
Posts: 187
Location: Why do you care?
*snickers at s.irver* Well, I've only been working with java for a week so, yeah, I'm not all the knowledgable. I'm rather good with Xhtml though.

Anyway, I'd just like to say thanks for the code and to say...

If we refuse to use new things simply becuase they seem complex we would be just like our grandparents. Afraid to ever advance forward, staying in our quite little room all to ourselfs without a computer, making textiles and what not.

Lesson? It's really quite simple. Get off your lazy rear and figure it out s.irver!!! It's not as hard as it looks!!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 01, 2005 10:33 am 
Offline
Templar Inner Circle
User avatar

Joined: Wed Mar 09, 2005 1:55 am
Posts: 2885
Location: Somewhere in my pants.
s.irver wrote:
yes javascrpit is a evil thing.

i try to avoid it at all times.
Javascript is not evil if you know how to use it. Once you get the hang of doing things with it, it will more than likely make your site much better.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group